Files
Client/test/api/cache_store_test.dart
T

22 lines
689 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/api/cache_store.dart';
void main() {
group('CacheStore.parse', () {
test('splits the timestamp header from the payload', () {
final entry = CacheStore.parse('1700000000000\n{"a":"b\\nc"}');
expect(entry!.lastUpdate, 1700000000000);
expect(entry.json, '{"a":"b\\nc"}');
});
test('keeps newlines inside the payload', () {
expect(CacheStore.parse('1\nline1\nline2')!.json, 'line1\nline2');
});
test('rejects files without a valid header', () {
expect(CacheStore.parse('{"a":1}'), isNull);
expect(CacheStore.parse('abc\n{}'), isNull);
});
});
}