Assignments from Viktoria Valova#9
Open
valovaViktoria wants to merge 20 commits intoanko-code-academy:mainfrom
Open
Assignments from Viktoria Valova#9valovaViktoria wants to merge 20 commits intoanko-code-academy:mainfrom
valovaViktoria wants to merge 20 commits intoanko-code-academy:mainfrom
Conversation
Resolve timing issues in onEmpty tests: - added delay(10) to "should call callback when queue becomes empty" - added delay(10) to "should support multiple onEmpty callbacks"
Prevented unhandled promise rejections with preventUnhandledRejection
81a8b74 to
356666e
Compare
ae87bfd to
c7a216f
Compare
a8c6756 to
57d94a9
Compare
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.
Assignment: 01 - Deep Clone
Checklist
npm run test:01)Assignment: 02 - Debounce & Throttle
Checklist
npm run test:02)Assignment: 03 - Custom Bind
Checklist
npm run test:03)Assignment: 04 - Memoization
Checklist
npm run test:04)Assignment: 05 - Custom Bind
Checklist
npm run test:05)Assignment: 06 -Async Queue
Checklist
npm run test:06)Test Timing Fix
Problem: Jest fake timers created race conditions with
onEmptycallbacksSolution: Added
delay(10)calls to ensure proper timing synchronizationImpact: Tests now reliably trigger callbacks when queue becomes empty
Assignment: 07 - Retry With Backoff
Checklist
npm run test:07)Jest Timing & Rejection Handling
Initial Approach: Implemented
runner = (async() => {})()IIFE pattern as demonstrated in classEncountered Issue:
Tests failed with
unhandled promise rejectionerrorsJest's
advanceTimersByTimeAsync()advances timers, but promise rejections happen immediatelyThis created race conditions: rejections occurred before
expect().rejects.toThrow()could handle themSolution:
Removed IIFE wrapper pattern, made retry function directly async (simplified implementation)
Created
preventUnhandledRejectionwrapper in tests to handle rejection timing with Jest fake timersApplied wrapper to all test cases expecting promise rejections
Impact: Tests now reliably handle promise rejections without timing conflicts
Assignment: 08 - Event Emitter
Checklist
npm run test:08)Assignment: 09 - Observable
Checklist
npm run test:09)Assignment: 10 - LRU Cache
Checklist
npm run test:10)Assignment: 11 -Singleton
Checklist
npm run test:11)Assignment: 12 -Factory Pattern
Checklist
npm run test:12)Assignment: 13 - Decorator Pattern
Checklist
npm run test:13)Assignment: 14 - Middleware Pipeline
Checklist
npm run test:14)Assignment: 15 - Dependency Injection
Checklist
npm run test:15)Assignment: 16 - State Machine
Checklist
npm run test:16)Assignment: 17 - Command Pattern
Checklist
npm run test:17)Assignment: 18 - Strategy Pattern
Checklist
npm run test:18)Assignment: 19 - Proxy Pattern
Checklist
npm run test:19)Assignment: 20 - Builder Pattern
Checklist
npm run test:20)Testing:
All tests pass locally