Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is Jest?

View

What is the purpose of the expect() function in Jest?

View

Which of the following Jest methods is used to group related tests?

View

How do you run all the Jest tests in a project?

View

Which Jest function is used to mock a function or module?

View

How do you test asynchronous code with Jest?

View

What does the Jest function beforeEach() do?

View

Which of the following methods in Jest is used to test if two values are deeply equal?

View

How can you skip a test in Jest?

View

Which Jest function is used to clear mocks between test cases?

View

What is Jest?

A JavaScript library
A testing framework for JavaScript
A CSS framework
A database library

What is the purpose of the expect() function in Jest?

To create test cases
To set up test environments
To define assertions that compare values
To handle exceptions

Which of the following Jest methods is used to group related tests?

test()
describe()
it()
group()

How do you run all the Jest tests in a project?

jest run
npm run test
jest test-all
node test

Which Jest function is used to mock a function or module?

mockFunction()
jest.fn()
jest.mock()
simulate()

How do you test asynchronous code with Jest?

Using async/await in the test functions
Using callbacks
By skipping the test
Asynchronous code cannot be tested with Jest

What does the Jest function beforeEach() do?

Runs before all the test suites
Runs before each individual test
Runs after each test
Initializes the testing framework

Which of the following methods in Jest is used to test if two values are deeply equal?

toBe()
toEqual()
toMatch()
toContain()

How can you skip a test in Jest?

By using skipTest()
By using test.skip()
By commenting out the test
By using test.disabled()

Which Jest function is used to clear mocks between test cases?

jest.clearAllMocks()
clearMocks()
resetMocks()
jest.clearMocks()