chore: remove obsolete tests, add design docs and PRD

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-05-09 14:32:24 +08:00
parent 2f45816cfc
commit d136dbf947
5 changed files with 1344 additions and 63 deletions

View File

@@ -1,29 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pad_scanner/models/scan_record.dart';
void main() {
group('ScanRecord', () {
test('creates with correct defaults', () {
final record = ScanRecord(
barcode: '1234567890',
codeType: 'CODE128',
timestamp: DateTime.parse('2026-05-07T10:30:00Z'),
);
expect(record.barcode, '1234567890');
expect(record.codeType, 'CODE128');
expect(record.status, SendStatus.pending);
});
test('toJson produces correct map', () {
final record = ScanRecord(
barcode: 'ABC123',
codeType: 'QR',
timestamp: DateTime.parse('2026-05-07T10:30:00Z'),
);
final json = record.toJson();
expect(json['barcode'], 'ABC123');
expect(json['code_type'], 'QR');
expect(json['timestamp'], '2026-05-07T10:30:00.000Z');
});
});
}

View File

@@ -1,34 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
import 'package:http/testing.dart';
import 'package:pad_scanner/services/api_service.dart';
void main() {
group('ApiService', () {
test('sendScanData returns true on 200', () async {
final client = MockClient((request) async {
return http.Response('{"status":"ok"}', 200);
});
final service = ApiService(client: client);
final result = await service.sendScanData(
'http://localhost:8000/scan',
barcode: '123456',
codeType: 'CODE128',
);
expect(result, isTrue);
});
test('sendScanData returns false on error', () async {
final client = MockClient((request) async {
return http.Response('error', 500);
});
final service = ApiService(client: client);
final result = await service.sendScanData(
'http://localhost:8000/scan',
barcode: '123456',
codeType: 'CODE128',
);
expect(result, isFalse);
});
});
}