🔧 Update tests to handle large JSON data and improve file loading error handling

This commit is contained in:
2026-01-29 03:24:38 +00:00
parent a34468275f
commit 9b4b418724

View File

@@ -333,13 +333,17 @@ describe('useGamemasterFiles', () => {
}); });
it('should be true for large files', async () => { it('should be true for large files', async () => {
// Create a large string that will split into many lines // Create large array that when JSON stringified will have many lines
const largeContent = Array(15000).fill('line').join('\n'); const largeData = {
mockClient.getPokemon.mockResolvedValueOnce(largeContent); items: Array(12000).fill({ id: 1, data: 'test' })
};
mockClient.getPokemon.mockResolvedValueOnce(largeData);
composable.selectedFile.value = 'pokemon'; composable.selectedFile.value = 'pokemon';
await composable.loadFile(); await composable.loadFile();
// Verify we have many lines (JSON.stringify adds newlines for pretty-print)
expect(composable.fileLines.value.length).toBeGreaterThan(10000);
expect(composable.fileTooLarge.value).toBe(true); expect(composable.fileTooLarge.value).toBe(true);
}); });
}); });