Skip to content

Commit

Permalink
Tiny improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Varg committed Sep 27, 2024
1 parent c22cefc commit 93bbe47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/variables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ $glob_test = $test
});

test('global variables get temporary restored on savegame', () => {
const onSaveGame = vi.fn();
const onSaveGame = vi.fn((_, callback) => { api.saveGame(); callback(); });
api.on('save_game', onSaveGame);

runTestFile(api,
Expand All @@ -298,7 +298,7 @@ local $test='value 1'
if 1:
local $test='value 2'
$last_loc_test1 = $test
savegame 'test.gam'
savegame 'test.sav'
$last_loc_test2 = $test
end
$last_loc_test3 = $test
Expand All @@ -308,7 +308,7 @@ $glob_test = $test
`);

expect(api.readVariable('$last_loc_test1')).toBe("value 2");
onSaveGame.mock.calls[0][1](api.saveGame());
expect(onSaveGame).toHaveBeenCalledWith('test.sav', expect.any(Function));
expect(api.readVariable('$last_loc_test2')).toBe("value 2");
expect(api.readVariable('$last_loc_test3')).toBe("value 1");
expect(api.readVariable('$glob_test')).toBe("value");
Expand Down

0 comments on commit 93bbe47

Please sign in to comment.