Jest MCQs Solution | TCS Fresco Play | FrescoPlay | MNC Answers
Make an effort to understand these solutions and apply them to your Hands-On difficulties. (It is not advisable that copy and paste these solutions).
All Question of the MCQs Present Below for Ease Use Ctrl + F with the question name to find the Question. All the Best!
1. Jest works well with other testing libraries like
all of the options
2. Jest is used to test _.
Java script
3. Jest is a JavaScript unit testing framework.
True
4. How to install Jest using npm?
npm install --save-dev jest
5. The below test will pass.
False
6. You can check strings against regular expressions with ______________ .
toMatch
7. Jest uses ________ and ________ matchers to test a value is with exact equality
ToBe , toEqual
8. The number can be compared using
all of the options
9. To create a mock function, we use jest.fn().
True
10. ______________ resets all information stored in the mockFn.mock.calls and mockFn.mock.instances arrays.
mockClear()
11. .mock is a property of mock function, the place where all information about how the function has been called is kept.
True
12. Jest supports ______________ for Isolating functionality into small, testable units under test.
Mock fn
13. The Asynchronous code will move on to another task before it finishes.
True
14. When you execute ______________ Code, it will move on to another task before it finishes.
asyn
15. Jest will wait until the ______________ callback is called before finishing the test.
done
16. ______________ is useful when you want to mock functions in certain test cases and restore the original implementation in others.
mockRestore()
17. ______________ resets all information stored in the mock, including any inital implementation given.
mockReset()
18. To test a particular function which throws an error when it's called, you can use toThrow.
True
19. Code coverage tests that how much code is covered under tests
True
20. ______________ is useful when you want to completely restore a mock back to its initial state.
mockreset
21. The Synchronous Code will move on to another task before it finishes.
False
22. What is the command to install Jest and the babel-jest ?
$ npm install –dev-save jest babel-jest
$ npm install jest --save-dev babel-jestxxx
$ npm install --save-dev jest babel-jest
$ npm install -save-dev jest babel-jest
23. ______________ returns the value only once when mock function is called.
mockReturnValue(value)xxx
mockReturnOnce(value)
mockReturnValueOnce(value)
None of the options
24. How to install Jest using yarn?
yarn add --dev jest
25. ______________ is an array that records all the object instances that have been instantiated from the mock function using new.
mock.instances
26. Which method is useful to clean up a mock's usage data between two assertions.
mockClear()
27. mockRestore() removes the mock and restores the initial implementation
True
28. How to install Jest using npm?
npm install jest --save-dev
npm install --save-dev jest
npm add –save-dev jest
all the optionsxxxx
Post a Comment