feat(save): persist story flags and node progress in v1
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user