test(fsrs): add unit tests for FSRS-lite module - #21
Open
yizhibibao125 wants to merge 1 commit into
Open
Conversation
Cover all four exported functions and the three constants: - initFsrs: default state, explicit now, confirmations seed - score: retrievability range, decay over time, age_days accuracy, status bucket boundaries (hot/warm/cool/archive_candidate) - reinforce: 30% stability growth, confirmations increment, last_confirmed update, pure-function guarantee, compounding - penalize: halving, floor at 1, immutability of other fields - combined workflows: reinforce after penalize, dormancy + refresh - constants: ARCHIVE_THRESHOLD, HOT_THRESHOLD, DEFAULT_INITIAL_STABILITY No runtime code changed. Tests use node:test + node:assert/strict, consistent with the existing test suite style. Co-authored-by: yizhibibao125 <143419304+yizhibibao125@users.noreply.github.com>
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.
Summary
Add a dedicated test file for the
fsrsmodule (packages/core/src/palace/fsrs.ts), which had no test coverage despite being a core mathematical primitive used by insights, room facts, and pipeline syntheses.What's covered
initFsrs— default stability, confirmations seed,last_confirmedvalidity, explicitnowparameterscore— retrievability range [0,1], decay over time,age_daysaccuracy, all four status bucket boundaries (hot/warm/cool/archive_candidate), stability passthroughreinforce— exact 30% stability growth, confirmations increment,last_confirmedupdate, pure-function guarantee, compounding over multiple callspenalize— stability halving, floor at 1 (including repeated penalizations), immutability oflast_confirmedandconfirmations, pure-function guaranteeARCHIVE_THRESHOLD,HOT_THRESHOLD,DEFAULT_INITIAL_STABILITYTests