Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basic testing
Test scripts
Notes
General task description
Your task is to write unit tests for code, provided in file
index.ts.Simple tests
Write unit tests for the
simpleCalculatorfunction, which performs basic mathematical operations - addition, subtraction, division, multiplication, and exponentiation. Your task is to verify that the operations are executed correctly and that the function returnsnullfor invalid input.Write your tests in
src/01-simple-tests/index.test.ts.Table tests
Your task is to rewrite the tests written in the previous task using the table-driven testing approach, utilizing the appropriate Jest API.
Write your tests in
src/02-table-tests/index.test.ts.Error handling & async
Your task is to test functions that work asynchronously/throw/reject exceptions..
Write your tests in
src/03-error-handling-async/index.test.ts.Testing class
Your task is to test a class representing a bank account that implements corresponding operations. Please note that some methods of the class invoke others, some operations result in errors, and the implementation is asynchronous and involves the native JS API. These aspects should be taken into account when writing the tests.
Write your tests in
src/04-test-class/index.test.ts.Partial mocking
Your task is to utilize the Jest API to partially mock the contents of a module.
Write your tests in
src/05-partial-mocking/index.test.ts.Mocking Node.js API
Your task is to test the proper usage of the Node.js API based on commonly used APIs such as the
fsmodule, as well assetTimeoutandsetInterval. Remember that the tests should not interact with the actual file system and should not rely on real-time!Write your tests in
src/06-mocking-node-api/index.test.ts.Mocking library API
Your task is to test that function that utilize library APIs is working correctly (with commonly used libraries such as
axiosandlodashas examples).Write your tests in
src/07-mocking-lib-api/index.test.ts.Snapshot testing
Your task is to use snapshot testing with Jest and compare it to regular comparison testing.
Write your tests in
src/08-snapshot-testing/index.test.ts.