62 lines
1.7 KiB
Dart
62 lines
1.7 KiB
Dart
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 I’M 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',
|
||
'IT’S THREE O’CLOCK',
|
||
segmentId: 'a0-08-c',
|
||
).complete,
|
||
isTrue,
|
||
);
|
||
});
|
||
}
|