feat(android): add FJ- attachment code type to CodeParser
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -62,4 +62,50 @@ void main() {
|
||||
expect(CodeParser.isLocation(CodeType.invalid), false);
|
||||
});
|
||||
});
|
||||
|
||||
group('CodeParser.parse attachmentCode (FJ-)', () {
|
||||
test('identifies FJ- with zongpai B type', () {
|
||||
final result = CodeParser.parse('FJ-26B1');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26B1');
|
||||
});
|
||||
test('identifies FJ- with zongpai C type', () {
|
||||
final result = CodeParser.parse('FJ-26C12');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26C12');
|
||||
});
|
||||
test('identifies FJ- with zongpai T type', () {
|
||||
final result = CodeParser.parse('FJ-26T3');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26T3');
|
||||
});
|
||||
test('identifies FJ- with zongpai BW 4-digit', () {
|
||||
final result = CodeParser.parse('FJ-26BW0001');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26BW0001');
|
||||
});
|
||||
test('identifies FJ- with zongpai CW 4-digit', () {
|
||||
final result = CodeParser.parse('FJ-26CW0015');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26CW0015');
|
||||
});
|
||||
test('normalizes lowercase fj- to uppercase', () {
|
||||
final result = CodeParser.parse('fj-26b1');
|
||||
expect(result.type, CodeType.attachmentCode);
|
||||
expect(result.value, '26B1');
|
||||
});
|
||||
test('rejects FJ without hyphen', () {
|
||||
expect(CodeParser.parse('FJ26B1').type, CodeType.invalid);
|
||||
});
|
||||
test('rejects FJ- with invalid zongpai', () {
|
||||
expect(CodeParser.parse('FJ-HELLO').type, CodeType.invalid);
|
||||
});
|
||||
test('rejects FJ- with BW short serial', () {
|
||||
expect(CodeParser.parse('FJ-26BW01').type, CodeType.invalid);
|
||||
});
|
||||
test('attaches original raw code with FJ- prefix for display', () {
|
||||
final result = CodeParser.parse('FJ-26B42360');
|
||||
expect(result.value, '26B42360');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user