Skip to content

Commit

Permalink
add a test to make sure first() will fail when zero result
Browse files Browse the repository at this point in the history
  • Loading branch information
andyli committed Sep 29, 2023
1 parent 440fdf5 commit 726a83a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Run.hx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ class Run extends TestWithDb {
});
}

public function firstInEmpty() {
db.User.first().handle(function (o) {
switch o {
case Success(_):
asserts.fail('should not return Success');
case Failure(err):
asserts.assert(err.code == 404);
asserts.done();
}
});
return asserts;
}

public function unionTest() {
return insertUsers().next(function (_)
return db.User.union(db.User).first()
Expand Down

0 comments on commit 726a83a

Please sign in to comment.