Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Jan 17, 2025
1 parent 094fd34 commit 83e9dfd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion hive/test/tests/registry/type_registry_impl_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ void main() {
contains('WARNING: You are trying to register TestAdapter'),
);
});

group('with typeId extension', () {
test('external', () {
final registry = TypeRegistryImpl();
registry.registerAdapter(TestAdapter(224));
final resolved = registry.findAdapterForValue(123)!;
expect(resolved.typeId, 320);
});

test('internal', () {
final registry = TypeRegistryImpl();
registry.registerAdapter(TestAdapter(32), internal: true);
final resolved = registry.findAdapterForValue(123)!;
expect(resolved.typeId, 256);
});
});
});

test('.findAdapterForTypeId()', () {
Expand Down Expand Up @@ -289,7 +305,7 @@ void main() {
expect(TypeRegistryImpl.calculateTypeId(65439, internal: false), 65535);
expect(
() => TypeRegistryImpl.calculateTypeId(65441, internal: false),
throwsA(isA<HiveError>()),
throwsHiveError(),
);
});
});
Expand Down

0 comments on commit 83e9dfd

Please sign in to comment.