GitHub - SviatlanaPuzevich/basic-testing
- Task: https://github.com/AlreadyBored/nodejs-assignments/blob/main/assignments/basic-testing/assignment.md
- Done - 2025-11-09/ deadline 2025-11-10
- Score: 258/258
Simple tests
- should add two numbers
- should subtract two numbers
- should multiply two numbers
- should divide two numbers
- should exponentiate two numbers
- should return null for invalid action
- should return null for invalid arguments
Table tests
Error handling & async
- should resolve provided value
- should throw error with provided message
- should throw error with default message if message is not provided
- should throw custom error
- should reject custom error
Testing class
- should create account with initial balance
- should throw InsufficientFundsError error when withdrawing more than balance
- should throw error when transferring more than balance
- should throw error when transferring to the same account
- should deposit money
- should withdraw money
- should transfer money
- fetchBalance should return number in case if request did not failed
- should set new balance if fetchBalance returned number
- should throw SynchronizationFailedError if fetchBalance returned null
Partial mocking
- mockOne, mockTwo, mockThree should not log into console
- unmockedFunction should log into console
Mocking Node.js API
- should set timeout with provided callback and timeout
- should call callback only after timeout
- should set interval with provided callback and timeout
- should call callback multiple times after multiple intervals
- should call join with pathToFile
- should return null if file does not exist
- should return file content if file exists
Mocking library API
- should create instance with provided base url
- should perform request to correct provided url
- should return response data
Snapshot testing
- should generate linked list from values 1
- should generate linked list from values 2
Forfeits
- -5 for each linter warning
- -10 for each linter/TS compiler error
- -30% of total task score Commits after deadline (except commits that affect only Readme.md, .gitignore, etc.)