Skip to content

Commit

Permalink
Tests: macOS now correctly throws unique violation exception.
Browse files Browse the repository at this point in the history
Follow-up from
ccec6e8 unblock macOS CI failure
  • Loading branch information
greenrobot-team committed Oct 16, 2023
1 parent ddd09b0 commit 2b92a17
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions objectbox_test/test/box_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ignore_for_file: deprecated_member_use

import 'dart:io';

import 'package:objectbox/objectbox.dart';
import 'package:test/test.dart';

Expand Down Expand Up @@ -240,18 +238,11 @@ void main() {
final object = TestEntity2()..value = 42;
final future = box.putQueuedAwaitResult(object);

try {
await future;
} catch (e) {
// TODO: Mac in GitHub CI (not locally reproducible yet)...
if (Platform.isMacOS) {
expect(e is ObjectBoxException, isTrue);
expect((e as ObjectBoxException).message, '');
} else {
expect(e is UniqueViolationException, isTrue);
expect(e.toString(), contains('Unique constraint'));
}
}
expect(
() async => await future,
throwsA(predicate((e) =>
e is UniqueViolationException &&
e.message.contains('Unique constraint'))));

expect(object.id, isNull); // ID must remain unassigned
}
Expand Down

0 comments on commit 2b92a17

Please sign in to comment.