feat(save): persist story flags and node progress in v1

This commit is contained in:
ginnoir
2026-06-11 18:52:16 -05:00
parent 51d3ec1a4b
commit 9196c77e25
4 changed files with 33 additions and 3 deletions
+13
View File
@@ -70,6 +70,19 @@ describe('loadGame()', () => {
expect(result.state.actionQueue).toEqual(['b']);
});
it('restores story fields on load', async () => {
const content = testContent();
const backend = createMemoryBackend();
const state = createGameState(content);
state.storyFlags = { route_b: true };
state.currentStoryNodeId = 'fork_choice';
state.seenStoryNodeIds = ['boot_intro'];
await saveGame(state, backend, 1000);
const loaded = await loadGame(content, backend, 1000);
expect(loaded.state.storyFlags.route_b).toBe(true);
expect(loaded.state.currentStoryNodeId).toBe('fork_choice');
});
it('drops an active action that no longer exists in content', async () => {
const content = testContent();
const stale = serializeSave(