Skip to content

Commit

Permalink
test: add more timestamp test
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jul 22, 2023
1 parent 5c7d411 commit 29dd8b9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sembast/test/timestamp_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ void main() {
expect(timestamp.toIso8601String(), '1970-01-01T00:00:01.000Z');
expect(timestamp.millisecondsSinceEpoch, 1000);
expect(timestamp.microsecondsSinceEpoch, 1000000);

timestamp = Timestamp.parse('1234-12-12T12:34:56.789Z');
expect(
Timestamp.fromMillisecondsSinceEpoch(
timestamp.millisecondsSinceEpoch),
timestamp);
timestamp = Timestamp.parse('1234-12-12T12:34:56.789123Z');
expect(
Timestamp.fromMicrosecondsSinceEpoch(timestamp.microsecondsSinceEpoch)
.toIso8601String(),
startsWith('1234-12-12T12:34:56.789')); // missing some precision !
});
test('equals', () {
expect(Timestamp(1, 2), Timestamp(1, 2));
Expand Down

0 comments on commit 29dd8b9

Please sign in to comment.