cyberhybridhub/server/test/spelling/spelling_progress_policy_test.dart
nathanAndrinoid 4459852f83
Some checks failed
Admin portal tests / test (push) Has been cancelled
spelling
2026-06-05 03:22:35 +00:00

40 lines
1019 B
Dart

import 'package:cyberhybridhub_server/spelling/spelling_progress_policy.dart';
import 'package:test/test.dart';
void main() {
test('weightForScore never drops below minWeight', () {
expect(
SpellingProgressPolicy.weightForScore(100),
SpellingProgressPolicy.minWeight,
);
});
test('weightForScore is higher for negative familiarity', () {
expect(
SpellingProgressPolicy.weightForScore(-3),
greaterThan(SpellingProgressPolicy.weightForScore(0)),
);
});
test('weightForScore is lower for positive familiarity', () {
expect(
SpellingProgressPolicy.weightForScore(5),
lessThan(SpellingProgressPolicy.weightForScore(0)),
);
});
test('scoreAfterAttempt moves up on correct and down on wrong', () {
expect(
SpellingProgressPolicy.scoreAfterAttempt(currentScore: 2, correct: true),
3,
);
expect(
SpellingProgressPolicy.scoreAfterAttempt(
currentScore: 2,
correct: false,
),
1,
);
});
}