Add comprehensive tests for the InventoryManager and InventoryContainer to validate item management functionalities. Implement integration tests for the CharacterSheet component, ensuring proper interaction with the inventory system. Update the Explorer class to support new inventory features and maintain backward compatibility. Refactor related components for improved clarity and performance.
42 lines
979 B
JavaScript
42 lines
979 B
JavaScript
import { expect } from "@esm-bundle/chai";
|
|
import sinon from "sinon";
|
|
import { GameLoop } from "../../../src/core/GameLoop.js";
|
|
import {
|
|
createGameLoopSetup,
|
|
cleanupGameLoop,
|
|
} from "./helpers.js";
|
|
|
|
describe("Core: GameLoop - Stop", function () {
|
|
this.timeout(30000);
|
|
|
|
let gameLoop;
|
|
let container;
|
|
|
|
beforeEach(() => {
|
|
const setup = createGameLoopSetup();
|
|
gameLoop = setup.gameLoop;
|
|
container = setup.container;
|
|
gameLoop.init(container);
|
|
});
|
|
|
|
afterEach(() => {
|
|
cleanupGameLoop(gameLoop, container);
|
|
});
|
|
|
|
it("CoA 4: stop() should halt animation loop", (done) => {
|
|
gameLoop.isRunning = true;
|
|
|
|
// Spy on animate
|
|
const spy = sinon.spy(gameLoop, "animate");
|
|
|
|
gameLoop.stop();
|
|
|
|
// Wait a short duration to ensure loop doesn't fire
|
|
// Using setTimeout instead of requestAnimationFrame for reliability in headless env
|
|
setTimeout(() => {
|
|
expect(gameLoop.isRunning).to.be.false;
|
|
done();
|
|
}, 50);
|
|
});
|
|
});
|
|
|