From a34468275f27a5d0d37a65b20dc10ec2d20e8a96 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Thu, 29 Jan 2026 03:24:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Improve=20test=20by=20adding=20s?= =?UTF-8?q?etup=20for=20available=20files=20before=20simulating=20load=20f?= =?UTF-8?q?ailure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/unit/composables/useGamemasterFiles.test.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/websites/pokedex.online/tests/unit/composables/useGamemasterFiles.test.js b/code/websites/pokedex.online/tests/unit/composables/useGamemasterFiles.test.js index f88e3d3..e11faad 100644 --- a/code/websites/pokedex.online/tests/unit/composables/useGamemasterFiles.test.js +++ b/code/websites/pokedex.online/tests/unit/composables/useGamemasterFiles.test.js @@ -192,8 +192,14 @@ describe('useGamemasterFiles', () => { }); it('should set error on load failure', async () => { - mockClient.getMoves.mockRejectedValueOnce(new Error('Load failed')); + // First, set up status so we have available files + mockClient.getStatus.mockResolvedValueOnce({ + available: [{ filename: 'moves.json', size: 3000 }] + }); await composable.loadStatus(); + + // Now set up the getMoves to fail + mockClient.getMoves.mockRejectedValueOnce(new Error('Load failed')); composable.selectedFile.value = 'moves'; await composable.loadFile();