Skip to content

Commit

Permalink
Add test for #49
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Oct 23, 2024
1 parent 4ca49c7 commit 1cc9fde
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/AssetCacheTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,20 @@ test("Uses formatUrlForDisplay when caching a promise", async (t) => {
fs.unlinkSync(cachePath);
fs.unlinkSync(jsonCachePath);
});

test("Uses filenameFormat", async (t) => {
let asset = new AssetCache("some-thing", undefined, {
filenameFormat() {
return "testing.json";
},
});

let cachePath = normalizePath(asset.cachePath);
t.truthy(cachePath.endsWith("/.cache/testing.json"))

await asset.save({ name: "Sophia Smith" }, "json");

t.truthy(fs.existsSync(cachePath));

asset.destroy();
});

0 comments on commit 1cc9fde

Please sign in to comment.