Skip to content

Commit

Permalink
Tests for 0m, 0h, 0d, 0w, 0y durations
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 19, 2024
1 parent c446a90 commit e2dc044
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/RemoteAssetCacheTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const RemoteAssetCache = require("../src/RemoteAssetCache");

test("getDurationMs", (t) => {
let cache = new RemoteAssetCache("https://example.com/");
// t.is(cache.getDurationMs("0"), 0);
t.is(cache.getDurationMs("0s"), 0);
t.is(cache.getDurationMs("1s"), 1000);
t.is(cache.getDurationMs("1m"), 60 * 1000);
t.is(cache.getDurationMs("1h"), 60 * 60 * 1000);
Expand All @@ -14,11 +16,16 @@ test("getDurationMs", (t) => {
t.is(cache.getDurationMs("1y"), 365 * 24 * 60 * 60 * 1000);

t.is(cache.getDurationMs("5s"), 5000);
t.is(cache.getDurationMs("0m"), 0);
t.is(cache.getDurationMs("7m"), 60 * 7000);
t.is(cache.getDurationMs("9h"), 60 * 60 * 9000);
t.is(cache.getDurationMs("0h"), 0);
t.is(cache.getDurationMs("11d"), 24 * 60 * 60 * 11000);
t.is(cache.getDurationMs("0d"), 0);
t.is(cache.getDurationMs("13w"), 7 * 24 * 60 * 60 * 13000);
t.is(cache.getDurationMs("0w"), 0);
t.is(cache.getDurationMs("15y"), 365 * 24 * 60 * 60 * 15000);
t.is(cache.getDurationMs("0y"), 0);
});

test("Local hash file names", async (t) => {
Expand Down

0 comments on commit e2dc044

Please sign in to comment.