FlashKeepers

JavaScript · JavaScript · College and University

JavaScript Testing Fundamentals

Unit testing concepts and common Jest matchers and mocking patterns for testing JavaScript code.

About this set

30 basic cards for JavaScript JavaScript. It opens with "What is unit testing?" and "What does the arrange, act, assert pattern mean?". More College and University decks are listed below.

30 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is unit testing?
Show answerTesting individual functions or modules in isolation to verify they work correctly
What does the arrange, act, assert pattern mean?
Show answerSet up test data and state (arrange), execute the code (act), verify the result (assert)
What is a test suite?
Show answerA collection of related test cases grouped together
What is a test case?
Show answerA single test that checks one specific behavior or output
What does Jest's toBe() matcher test?
Show answerStrict equality (===) between two values
What does Jest's toEqual() matcher test?
Show answerDeep equality, checking that objects or arrays have the same contents
What does Jest's toStrictEqual() matcher test?
Show answerDeep equality with strict type checking, including undefined properties
What does Jest's toContain() matcher test?
Show answerWhether an array contains a specific element or a string contains a substring
What does Jest's toMatch() matcher test?
Show answerWhether a string matches a given regular expression
What does Jest's toBeDefined() matcher test?
Show answerWhether a value is not undefined
What does Jest's toBeNull() matcher test?
Show answerWhether a value is exactly null
What does Jest's toBeUndefined() matcher test?
Show answerWhether a value is undefined
What does Jest's toBeTruthy() matcher test?
Show answerWhether a value evaluates to true in a boolean context
What does Jest's toBeFalsy() matcher test?
Show answerWhether a value evaluates to false in a boolean context
What does Jest's toThrow() matcher test?
Show answerWhether a function throws an error when called

15 more cards in the app

Study this set free