forked from mem9-ai/mem9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworld-state-panel.test.tsx
More file actions
70 lines (67 loc) · 2.23 KB
/
world-state-panel.test.tsx
File metadata and controls
70 lines (67 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { PixelFarmWorldStatePanel } from "./world-state-panel";
describe("PixelFarmWorldStatePanel", () => {
it("renders the new fields, buckets, and NPC summary", () => {
render(
<PixelFarmWorldStatePanel
spaceId="space-1"
worldQuery={{
error: null,
memoryById: {},
resolveInteractionMemories: async () => [],
status: "ready",
worldState: {
activeSpaceId: "space-1",
fetchedAt: "2026-04-04T00:00:00.000Z",
fields: {
eventField: {
kind: "event",
cells: [{ row: 19, column: 35 }],
bounds: {
minRow: 19,
maxRow: 19,
minColumn: 35,
maxColumn: 35,
},
},
mainField: {
kind: "main",
cells: [{ row: 16, column: 23 }],
bounds: {
minRow: 16,
maxRow: 16,
minColumn: 23,
maxColumn: 23,
},
},
},
memoryBuckets: [
{
id: "bucket-work",
cropFamily: "crop-01",
plantCapacity: 10,
plantCount: 6,
plants: [],
rank: 1,
sortedMemoryIds: [],
tagKey: "work",
tagLabel: "Work",
totalMemoryCount: 52,
},
],
npcs: [{ id: "npc-cow-1", kind: "cow", position: null }],
recentEvents: [],
totalMemories: 69,
},
}}
/>,
);
fireEvent.click(screen.getByRole("button", { name: "Open World Snapshot" }));
expect(screen.getByText("69 active memories")).toBeInTheDocument();
expect(screen.getByText("Main field: 1 tiles")).toBeInTheDocument();
expect(screen.getByText("Event field: 1 tiles")).toBeInTheDocument();
expect(screen.getByText("52 memories, 6 plants")).toBeInTheDocument();
expect(screen.getByText("NPCs: 1")).toBeInTheDocument();
});
});