- Introduce the MissionDebrief component to display after-action reports, including XP, rewards, and squad status. - Implement the MissionGenerator class to create procedural side missions, enhancing replayability and resource management. - Update mission schema to include mission objects for INTERACT objectives, improving mission complexity. - Enhance GameLoop and MissionManager to support new mission features and interactions. - Add tests for MissionDebrief and MissionGenerator to ensure functionality and integration within the game architecture.
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import { expect } from "@esm-bundle/chai";
|
|
import * as THREE from "three";
|
|
import { GameLoop } from "../../../src/core/GameLoop.js";
|
|
import {
|
|
createGameLoopSetup,
|
|
cleanupGameLoop,
|
|
createRunData,
|
|
} from "./helpers.js";
|
|
|
|
describe("Core: GameLoop - Initialization", function () {
|
|
this.timeout(30000);
|
|
|
|
let gameLoop;
|
|
let container;
|
|
|
|
beforeEach(() => {
|
|
const setup = createGameLoopSetup();
|
|
gameLoop = setup.gameLoop;
|
|
container = setup.container;
|
|
});
|
|
|
|
afterEach(() => {
|
|
cleanupGameLoop(gameLoop, container);
|
|
});
|
|
|
|
it("CoA 1: init() should setup Three.js scene, camera, and renderer", () => {
|
|
gameLoop.init(container);
|
|
|
|
expect(gameLoop.scene).to.be.instanceOf(THREE.Scene);
|
|
expect(gameLoop.camera).to.be.instanceOf(THREE.PerspectiveCamera);
|
|
expect(gameLoop.renderer).to.be.instanceOf(THREE.WebGLRenderer);
|
|
|
|
// Verify renderer is attached to DOM
|
|
expect(container.querySelector("canvas")).to.exist;
|
|
});
|
|
|
|
it("CoA 2: startLevel() should initialize grid, visuals, and generate world", async () => {
|
|
gameLoop.init(container);
|
|
|
|
const runData = createRunData();
|
|
|
|
await gameLoop.startLevel(runData, { startAnimation: false });
|
|
|
|
// Grid should be populated
|
|
expect(gameLoop.grid).to.exist;
|
|
// Check center of map (likely not empty for RuinGen) or at least check valid bounds
|
|
expect(gameLoop.grid.size.x).to.be.greaterThan(0);
|
|
|
|
// VoxelManager should be initialized
|
|
expect(gameLoop.voxelManager).to.exist;
|
|
// Should have visual meshes
|
|
expect(gameLoop.scene.children.length).to.be.greaterThan(0);
|
|
});
|
|
});
|
|
|
|
|