Files
English/kouyu_english/test/writing_feedback_test.dart

65 lines
1.8 KiB
Dart
Raw Permalink 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-a', 'Hello. I am Alex.');
expect(result.complete, isTrue);
});
test(
'requests the missing sentence frame without rejecting a valid place',
() {
expect(WritingFeedback.check('a0-06-a', 'Hong Kong.').complete, isFalse);
expect(
WritingFeedback.check('a0-06-a', "I'm from Shanghai.").complete,
isTrue,
);
},
);
test('requires the three independent parts in lesson ten', () {
expect(
WritingFeedback.check('a0-10-a', "I'm Alex. I'm from Beijing.").complete,
isFalse,
);
expect(
WritingFeedback.check(
'a0-10-a',
"I'm Alex. I'm from Beijing. I like tea.",
).complete,
isFalse,
);
expect(
WritingFeedback.check(
'a0-10-a',
"I'm Alex. I'm from Beijing. I like water.",
).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-a', ' HELLO I AM ALEX ').complete,
isTrue,
);
// a0-01 with curly quote and multiple spaces
expect(
WritingFeedback.check('a0-01-a', 'HI IM MIA').complete,
isTrue,
);
// a0-07 with multiple spaces in phrase
expect(
WritingFeedback.check('a0-07-a', 'THIS IS MY MOTHER').complete,
isTrue,
);
// a0-08-c with multiple spaces and curly apostrophe
expect(
WritingFeedback.check('a0-08-c', 'ITS THREE OCLOCK').complete,
isTrue,
);
});
}