You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
import 'package:test/test.dart';
|
|
import 'package:practice_engine/models/deck_config.dart';
|
|
|
|
void main() {
|
|
group('DeckConfig', () {
|
|
test('has default values', () {
|
|
const config = DeckConfig();
|
|
|
|
expect(config.requiredConsecutiveCorrect, equals(3));
|
|
expect(config.defaultAttemptSize, equals(10));
|
|
expect(config.priorityIncreaseOnIncorrect, equals(5));
|
|
expect(config.priorityDecreaseOnCorrect, equals(2));
|
|
expect(config.immediateFeedbackEnabled, equals(true));
|
|
});
|
|
|
|
test('can be created with custom values', () {
|
|
const config = DeckConfig(
|
|
requiredConsecutiveCorrect: 5,
|
|
defaultAttemptSize: 20,
|
|
priorityIncreaseOnIncorrect: 10,
|
|
priorityDecreaseOnCorrect: 3,
|
|
immediateFeedbackEnabled: false,
|
|
);
|
|
|
|
expect(config.requiredConsecutiveCorrect, equals(5));
|
|
expect(config.defaultAttemptSize, equals(20));
|
|
expect(config.priorityIncreaseOnIncorrect, equals(10));
|
|
expect(config.priorityDecreaseOnCorrect, equals(3));
|
|
expect(config.immediateFeedbackEnabled, equals(false));
|
|
});
|
|
|
|
test('copyWith creates new config with updated fields', () {
|
|
const config = DeckConfig();
|
|
final updated = config.copyWith(
|
|
requiredConsecutiveCorrect: 4,
|
|
immediateFeedbackEnabled: false,
|
|
);
|
|
|
|
expect(updated.requiredConsecutiveCorrect, equals(4));
|
|
expect(updated.defaultAttemptSize, equals(config.defaultAttemptSize));
|
|
expect(updated.immediateFeedbackEnabled, equals(false));
|
|
});
|
|
|
|
test('equality works correctly', () {
|
|
const config1 = DeckConfig();
|
|
const config2 = DeckConfig();
|
|
const config3 = DeckConfig(requiredConsecutiveCorrect: 5);
|
|
|
|
expect(config1, equals(config2));
|
|
expect(config1, isNot(equals(config3)));
|
|
});
|
|
});
|
|
}
|
|
|