Skip to content

Commit 1cc9fde

Browse files
committed
Add test for #49
1 parent 4ca49c7 commit 1cc9fde

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/AssetCacheTest.js

+17
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,20 @@ test("Uses formatUrlForDisplay when caching a promise", async (t) => {
8080
fs.unlinkSync(cachePath);
8181
fs.unlinkSync(jsonCachePath);
8282
});
83+
84+
test("Uses filenameFormat", async (t) => {
85+
let asset = new AssetCache("some-thing", undefined, {
86+
filenameFormat() {
87+
return "testing.json";
88+
},
89+
});
90+
91+
let cachePath = normalizePath(asset.cachePath);
92+
t.truthy(cachePath.endsWith("/.cache/testing.json"))
93+
94+
await asset.save({ name: "Sophia Smith" }, "json");
95+
96+
t.truthy(fs.existsSync(cachePath));
97+
98+
asset.destroy();
99+
});

0 commit comments

Comments
 (0)