improved performance and battery usage on older devices
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user