forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
6114a2295f
commit
69809f7228
593 files changed
+903643
-40774
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import test from "node:test";
|
||||
import { writeNativeWaterAuditCacheAliases } from "./native-water-audit-cache.mjs";
|
||||
|
||||
test("water audit-cache aliases preserve exact DDS/PNG bytes under a unique texture basename", async () => {
|
||||
const projectRoot = await mkdtemp(path.join(os.tmpdir(), "native-water-audit-cache-"));
|
||||
const auditCacheRoot = path.join(projectRoot, "water-audit-cache");
|
||||
const ddsBytes = Buffer.from("source-dds-frame");
|
||||
const pngBytes = Buffer.from("prepared-lossless-png-frame");
|
||||
const options = { projectRoot, auditCacheRoot, variantName: "rom-water-normal-1234-00", ddsBytes, pngBytes };
|
||||
try {
|
||||
const first = await writeNativeWaterAuditCacheAliases(options);
|
||||
const second = await writeNativeWaterAuditCacheAliases(options);
|
||||
assert.deepEqual(second, first, "existing exact aliases are safe to reuse");
|
||||
assert.match(first.rawDds.path, /raw\/textures\/rom-water-normal-1234-00\.dds$/);
|
||||
assert.match(first.preparedPng.path, /prepared\/textures\/rom-water-normal-1234-00\.png$/);
|
||||
assert.equal(first.rawDds.bytes, ddsBytes.length);
|
||||
assert.equal(first.preparedPng.bytes, pngBytes.length);
|
||||
await assert.rejects(writeNativeWaterAuditCacheAliases({
|
||||
...options,
|
||||
ddsBytes: Buffer.from("different source frame"),
|
||||
}), /non-identical/);
|
||||
await assert.rejects(writeNativeWaterAuditCacheAliases({
|
||||
...options,
|
||||
variantName: "../escape",
|
||||
}), /safe texture basename/);
|
||||
} finally {
|
||||
await rm(projectRoot, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user