Files
English/kouyu_english/test/writing_feedback_test.dart
T

62 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter_test/flutter_test.dart';
import 'package:kouyu_english/core/writing_feedback.dart';
void main() {
test('accepts a variable name in the first lesson', () {
final result = WritingFeedback.check('a0-01', 'Hello. I am Alex.');
expect(result.complete, isTrue);
});
test(
'requests the missing sentence frame without rejecting a valid place',
() {
expect(WritingFeedback.check('a0-06', 'Hong Kong.').complete, isFalse);
expect(
WritingFeedback.check('a0-06', "I'm from Shanghai.").complete,
isTrue,
);
},
);
test('requires the three independent parts in lesson ten', () {
expect(
WritingFeedback.check('a0-10', "I'm Alex. I'm from Beijing.").complete,
isFalse,
);
expect(
WritingFeedback.check(
'a0-10',
"I'm Alex. I'm from Beijing. I like tea.",
).complete,
isTrue,
);
});
test('ignores multiple spaces, mixed casing and curly apostrophes', () {
// a0-01 greeting and name with multiple spaces and uppercase
expect(
WritingFeedback.check('a0-01', ' HELLO I AM ALEX ').complete,
isTrue,
);
// a0-01 with curly quote and multiple spaces
expect(
WritingFeedback.check('a0-01', 'HI IM MIA').complete,
isTrue,
);
// a0-07 with multiple spaces in phrase
expect(
WritingFeedback.check('a0-07', 'THIS IS MY MOTHER').complete,
isTrue,
);
// a0-08-c with multiple spaces and curly apostrophe
expect(
WritingFeedback.check(
'a0-08-c',
'ITS THREE OCLOCK',
segmentId: 'a0-08-c',
).complete,
isTrue,
);
});
}