Jest Multiple choice question with answer | Jest TCS Fresco play dumps | Jest TCS Fresco Play Answers | Jest MCQs TCS | Jest Objective type question with answer | jest tcs fresco play courses without handson | Jest TFactor Answer Dumps
Q1.Jest works well with other testing libraries like
ANS – all
Q2.Jest is used to test ______.
ANS – Java script
Q3.Jest is a JavaScript unit testing framework.
True
Q4.How to install Jest using npm?
ANS – npm install –save-dev jest
Q5.The below test will pass.
False
Q6.You can check strings against regular expressions with _______ .
ANS – toMatch
Q7.Jest uses and matchers to test a value is with exact equality
ANS – ToBe , toEqual
Q8.The number can be compared using
all
Q9.To create a mock function, we use jest.fn().
True
Q10.__ resets all information stored in the mockFn.mock.calls and mockFn.mock.instances arrays.
ANS – mockClear()
Q11.mock is a property of mock function, the place where all information about how the function has been called is kept.
True
Q12.Jest supports __ for Isolating functionality into small, testable units under test.
ANS – Mock fn
Q13.The Asynchronous code will move on to another task before it finishes.
True
Q14.When you execute __ Code, it will move on to another task before it finishes.
ANS – asyn
Q15.Jest will wait until the __ callback is called before finishing the test.
ANS – done
Q16.__ is useful when you want to mock functions in certain test cases and restore the original implementation in others.
ANS – mockRestore()
Q17._____ resets all information stored in the mock, including any inital implementation given.
ANS – mockReset()
Q18.To test a particular function which throws an error when it’s called, you can use toThrow.
True
Q19.Code coverage tests that how much code is covered under tests
True
Q20.______ is useful when you want to completely restore a mock back to its initial state.
ANS – mockreset
Q21.The Synchronous Code will move on to another task before it finishes.
False
Q22.What is the command to install Jest and the babel-jest ?
ANS – $ 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
Q23._____ returns the value only once when mock function is called.
ANS – mockReturnValue(value)xxx
mockReturnOnce(value)
mockReturnValueOnce(value)
Q24.How to install Jest using yarn?
ANS – yarn add –dev jest
Q25.______ is an array that records all the object instances that have been instantiated from the mock function using new.
ANS – mock.instances
Q26.Which method is useful to clean up a mock’s usage data between two assertions.
ANS – mockClear()
Q27.mockRestore() removes the mock and restores the initial implementation
True
Q28.How to install Jest using npm?
ANS – npm install jest –save-dev
npm install –save-dev jest
npm add �save-dev jest
all the optionsxxxx