Refactor project-document-json.test.ts by removing Scene Exit entities and updating test cases
This commit is contained in:
@@ -39,7 +39,6 @@ import {
|
|||||||
createNpcEntity,
|
createNpcEntity,
|
||||||
createNpcTimeWindowPresence,
|
createNpcTimeWindowPresence,
|
||||||
createSceneEntryEntity,
|
createSceneEntryEntity,
|
||||||
createSceneExitEntity,
|
|
||||||
createTriggerVolumeEntity
|
createTriggerVolumeEntity
|
||||||
} from "../../src/entities/entity-instances";
|
} from "../../src/entities/entity-instances";
|
||||||
import { createProjectScheduleRoutine } from "../../src/scheduler/project-scheduler";
|
import { createProjectScheduleRoutine } from "../../src/scheduler/project-scheduler";
|
||||||
@@ -389,16 +388,6 @@ describe("project document JSON", () => {
|
|||||||
},
|
},
|
||||||
yawDegrees: 180
|
yawDegrees: 180
|
||||||
});
|
});
|
||||||
const mainExit = createSceneExitEntity({
|
|
||||||
id: "entity-scene-exit-main-hatch",
|
|
||||||
position: {
|
|
||||||
x: 0,
|
|
||||||
y: 1,
|
|
||||||
z: 3
|
|
||||||
},
|
|
||||||
targetSceneId: "scene-cellar",
|
|
||||||
targetEntryEntityId: cellarEntry.id
|
|
||||||
});
|
|
||||||
const document = {
|
const document = {
|
||||||
...createEmptyProjectDocument({
|
...createEmptyProjectDocument({
|
||||||
name: "Castle Project",
|
name: "Castle Project",
|
||||||
@@ -421,7 +410,6 @@ describe("project document JSON", () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
document.scenes["scene-main"].entities[mainExit.id] = mainExit;
|
|
||||||
document.scenes["scene-cellar"].entities[cellarEntry.id] = cellarEntry;
|
document.scenes["scene-cellar"].entities[cellarEntry.id] = cellarEntry;
|
||||||
document.scenes["scene-main"].editorPreferences = {
|
document.scenes["scene-main"].editorPreferences = {
|
||||||
...document.scenes["scene-main"].editorPreferences,
|
...document.scenes["scene-main"].editorPreferences,
|
||||||
@@ -950,7 +938,7 @@ describe("project document JSON", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("migrates v23 project documents without Scene Entry and Scene Exit entities", () => {
|
it("migrates v23 project documents without Scene Entry entities", () => {
|
||||||
const legacyScene = createEmptyProjectScene({
|
const legacyScene = createEmptyProjectScene({
|
||||||
id: "scene-main",
|
id: "scene-main",
|
||||||
name: "Legacy Entry"
|
name: "Legacy Entry"
|
||||||
@@ -1041,19 +1029,25 @@ describe("project document JSON", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rejects Scene Exit targets that point at a missing Scene Entry", () => {
|
it("rejects scene transition sequence targets that point at a missing Scene Entry", () => {
|
||||||
const document = createEmptyProjectDocument({ sceneName: "Outside" });
|
const document = createEmptyProjectDocument({ sceneName: "Outside" });
|
||||||
const targetScene = createEmptyProjectScene({
|
const targetScene = createEmptyProjectScene({
|
||||||
id: "scene-house",
|
id: "scene-house",
|
||||||
name: "House"
|
name: "House"
|
||||||
});
|
});
|
||||||
document.scenes[targetScene.id] = targetScene;
|
document.scenes[targetScene.id] = targetScene;
|
||||||
document.scenes["scene-main"].entities["entity-scene-exit-door"] =
|
document.sequences.sequences["sequence-enter-house"] = createProjectSequence({
|
||||||
createSceneExitEntity({
|
id: "sequence-enter-house",
|
||||||
id: "entity-scene-exit-door",
|
title: "Enter House",
|
||||||
targetSceneId: targetScene.id,
|
effects: [
|
||||||
targetEntryEntityId: "missing-entry"
|
{
|
||||||
});
|
stepClass: "impulse",
|
||||||
|
type: "startSceneTransition",
|
||||||
|
targetSceneId: targetScene.id,
|
||||||
|
targetEntryEntityId: "missing-entry"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
expect(() =>
|
expect(() =>
|
||||||
parseProjectDocumentJson(JSON.stringify(document))
|
parseProjectDocumentJson(JSON.stringify(document))
|
||||||
|
|||||||
Reference in New Issue
Block a user