This week you will implement your library and write unit tests based on your approved API from Week 1.
Your goal is to produce a working, tested, and reliable library that matches your documented behavior.
You must have instructor approval for your API from Week 1 before starting implementation.
If your API is not approved, stop and fix it first.
By the end of this week, your repository should contain:
- complete implementation of all exports
- a passing test suite
- a README that accurately reflects real behavior
You must:
- Implement all exported functions/components from your approved API
- Write unit tests for each export
- Verify that behavior matches your README and spec
- Fix any bugs revealed by your tests
For each exported function, you must include:
- at least 2 normal test cases
- at least 1 edge case
- meaningful assertions (tests must actually verify behavior)
Where appropriate, include:
- invalid input tests
- fail when behavior is incorrect
- pass when behavior is correct
If your tests never fail, they are not useful.
Write a first working version.
Describe expected behavior clearly.
npm testUse failing tests to guide fixes.
Move to the next function.
Your code should be:
- readable and well-organized
- consistent with your API design
- correctly typed with TypeScript
- free of unnecessary complexity
Avoid:
- copying code from the internet
- overengineering simple functions
- ignoring edge cases
Your README.md must now reflect the real implementation.
Update it to include:
- accurate examples (must match actual behavior)
- any edge cases discovered during testing
- any changes made from your original API design
Your repository must include:
- complete implementation of your library
- passing test suite (
npm test) - updated README with correct examples
| Criteria | Points |
|---|---|
| Correct implementation | 40 |
| Test quality and coverage | 30 |
| Alignment with approved API | 15 |
| Code clarity and TypeScript usage | 10 |
| Completeness | 5 |
You are finished when:
- all required exports are implemented
- your tests clearly describe behavior
- your tests fail when behavior is incorrect (at some point)
- all tests pass after fixes
- your README matches your implementation
Do not:
- publish to npm yet
- start building the PostKit app
Your code will be reviewed before publishing.
- writing tests that always pass
- writing only one test per function
- ignoring edge cases
- not updating README after implementation
- fixing code without writing tests first
This week is about turning your design into working, tested code.
Focus on:
correctness, clarity, and confidence in your implementation.