Guard OPFS preview-cache staging
This commit is contained in:
@@ -111,6 +111,14 @@ function assertSessionSnapshotStoragePath(sessionId, path, filename = "snapshot.
|
||||
);
|
||||
}
|
||||
|
||||
function assertPreviewCacheStoragePath(cacheKey, path, filename = "preview.json") {
|
||||
assert.equal(
|
||||
path,
|
||||
`linuxcnc/preview-cache/${cacheKey}/${filename}`,
|
||||
`${cacheKey}/${filename} preview cache OPFS path drift`,
|
||||
);
|
||||
}
|
||||
|
||||
assert.equal(await getOpfsRoot(storage), root);
|
||||
|
||||
assert.equal(normalizeOpfsPath("linuxcnc/machines/xyzab.ini"), "linuxcnc/machines/xyzab.ini");
|
||||
@@ -122,7 +130,12 @@ assertGcodeProgramStoragePath(
|
||||
"custom-fixture.ngc",
|
||||
gcodeProgramPath("custom-fixture.ngc"),
|
||||
);
|
||||
assert.equal(previewCachePath("fixture"), "linuxcnc/preview-cache/fixture/preview.json");
|
||||
assertPreviewCacheStoragePath("fixture", previewCachePath("fixture"));
|
||||
assertPreviewCacheStoragePath(
|
||||
"fixture",
|
||||
previewCachePath("fixture", "custom-preview.json"),
|
||||
"custom-preview.json",
|
||||
);
|
||||
assertSessionSnapshotStoragePath(
|
||||
"session-1",
|
||||
sessionSnapshotPath("session-1"),
|
||||
|
||||
Reference in New Issue
Block a user