51 lines
2.0 KiB
JavaScript
51 lines
2.0 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { Document } from "@gltf-transform/core";
|
|
import test from "node:test";
|
|
import {
|
|
applyRunewakerSurfaceQualityPolicies,
|
|
runewakerSurfaceQualityPolicyIds,
|
|
} from "./lib/rom-surface-quality-policies.mjs";
|
|
|
|
test("surface-quality opt-ins are limited to the reviewed Barren and HOTO source policies", async () => {
|
|
assert.deepEqual(runewakerSurfaceQualityPolicyIds, {
|
|
barrenCaves: "rom-barren-caves-wretched-tunnel-surface-quality-v2",
|
|
hoto: "rom-hoto-source-rock-detail-v2",
|
|
});
|
|
await assert.rejects(applyRunewakerSurfaceQualityPolicies(new Document(), {
|
|
dungeonId: "hoto",
|
|
policyIds: ["rom-barren-caves-wretched-tunnel-surface-quality-v2"],
|
|
}), /Unknown or mismatched/);
|
|
});
|
|
|
|
test("HOTO detail policy validates the pinned ROS identity before editing a document", async () => {
|
|
const document = new Document();
|
|
const sourceReport = {
|
|
sourceModel: "model\\dungeon\\echoes_of_the_sea\\act_echoes_of_the_sea.ros",
|
|
sourceResourceSha256: "0".repeat(64),
|
|
materials: [],
|
|
};
|
|
await assert.rejects(applyRunewakerSurfaceQualityPolicies(document, {
|
|
dungeonId: "hoto",
|
|
policyIds: [runewakerSurfaceQualityPolicyIds.hoto],
|
|
sourceReport,
|
|
}), /source ROS SHA-256/);
|
|
assert.equal(document.getRoot().listMaterials().length, 0);
|
|
assert.equal(document.getRoot().listExtensionsUsed().length, 0);
|
|
});
|
|
|
|
test("Barren atlas-safe policy validates the pinned native ROS before reading or splitting geometry", async () => {
|
|
const document = new Document();
|
|
const sourceReport = {
|
|
sourceModel: "model/dungeon/wretched_grotto/act_world_wretched_grotto.ros",
|
|
sourceResourceSha256: "0".repeat(64),
|
|
materials: [],
|
|
};
|
|
await assert.rejects(applyRunewakerSurfaceQualityPolicies(document, {
|
|
dungeonId: "barren-caves",
|
|
policyIds: [runewakerSurfaceQualityPolicyIds.barrenCaves],
|
|
sourceReport,
|
|
}), /source ROS SHA-256/);
|
|
assert.equal(document.getRoot().listMaterials().length, 0);
|
|
assert.equal(document.getRoot().listAccessors().length, 0);
|
|
});
|