Skip to content

Commit

Permalink
add loop test
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiko732 committed Sep 12, 2024
1 parent 8d6d9d1 commit 970c9ae
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion __tests__/FSRSV5.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('get retrievability', () => {
test('return 0.00% for new cards', () => {
const card = createEmptyCard()
const now = new Date()
const expected = "0.00%"
const expected = '0.00%'
expect(fsrs.get_retrievability(card, now)).toBe(expected)
})

Expand All @@ -144,6 +144,23 @@ describe('get retrievability', () => {
).toBe(r_number[index])
})
})

test('loop Again', () => {
const fsrs = new FSRS({})
let card = createEmptyCard()
let now = new Date()
let i = 0
while (i < 10 ** 3) {
card = fsrs.next(card, now, Rating.Again).card
now = card.due
i++

const r = fsrs.get_retrievability(card, now, false)
console.debug(`Loop ${i}: s:${card.stability} r:${r} `)

expect(r).not.toBeNaN()
}
})
})

describe('fsrs.next method', () => {
Expand Down

0 comments on commit 970c9ae

Please sign in to comment.