Skip to content

Commit fc69fe5

Browse files
committed
test: add test cases for storage key
1 parent 37e9f09 commit fc69fe5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import 'package:grumpy/grumpy.dart';
2+
import 'package:test/test.dart';
3+
4+
void main() {
5+
group('StorageKey', () {
6+
test('.asStorageKey() is reversible', () {
7+
final key = const StorageKey(
8+
namespace: 'test',
9+
primaryKey: 'asStorageKey()',
10+
schemaId: 'reversible',
11+
);
12+
13+
final storageKey = key.asStorageKey();
14+
final reversedKey = StorageKey.parse(storageKey);
15+
expect(reversedKey, key);
16+
expect(storageKey, key.asStorageKey());
17+
});
18+
19+
test('parse throws on invalid format', () {
20+
expect(
21+
() => StorageKey.parse('invalid-format'),
22+
throwsA(isA<FormatException>()),
23+
);
24+
});
25+
});
26+
}

0 commit comments

Comments
 (0)