Skip to content

Commit

Permalink
test: add unit test for unix time
Browse files Browse the repository at this point in the history
Signed-off-by: Zhenchi <[email protected]>
  • Loading branch information
zhongzc committed Jan 24, 2024
1 parent fce1a5a commit 4b8c025
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ mod tests {
let _ = nanos_per_cycle();
}

#[test]
#[wasm_bindgen_test]
fn test_unix_time() {
let now = Instant::now();
let anchor = Anchor::new();
let unix_nanos = now.as_unix_nanos(&anchor);
assert!(unix_nanos > 0);
}

#[test]
fn test_duration() {
let mut rng = rand::thread_rng();
Expand Down

0 comments on commit 4b8c025

Please sign in to comment.