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
+11
View File
@@ -58,6 +58,17 @@ describe('createSave()', () => {
state.actionQueue.push('forage');
expect(save.state.actionQueue).toEqual(['forage', 'forage']);
});
it('snapshots story fields in the save payload', () => {
const state = sampleState();
state.storyFlags = { route_a: true };
state.currentStoryNodeId = 'route_a_beat';
state.seenStoryNodeIds = ['boot_intro', 'route_a_beat'];
const save = createSave(state, 1700);
expect(save.state.storyFlags).toEqual({ route_a: true });
expect(save.state.currentStoryNodeId).toBe('route_a_beat');
expect(save.state.seenStoryNodeIds).toHaveLength(2);
});
});
describe('serialize / deserialize round-trip', () => {