| 1 | import test from "node:test"; |
| 2 | import assert from "node:assert/strict"; |
| 3 | import { createEmptyChunkData } from "../src/world/chunkData.js"; |
| 4 | import { diffChunks } from "../src/editor/service.js"; |
| 5 | import { GroundType, BlockType } from "../../shared/definitions/tiles.js"; |
| 6 | |
| 7 | test("chunk diffs describe ground, block, and open-closed changes", () => |
| 8 | { |
| 9 | const previous = createEmptyChunkData(); |
| 10 | const next = createEmptyChunkData(); |
| 11 | next.open = true; |
| 12 | next.grounds[0] = GroundType.wood; |
| 13 | next.blocks[1] = { typeId: BlockType.torch, config: null }; |
| 14 | const bullets = diffChunks(0, 0, previous, next, false); |
| 15 | assert.ok(bullets.includes("Chunk opened.")); |
| 16 | assert.ok(bullets.some((line) => line.includes("Ground at 0, 0 changed from Grass to Wood."))); |
| 17 | assert.ok(bullets.some((line) => line.includes("Block Torch placed at 1, 0."))); |
| 18 | }); |