🔧 Update tests to handle large JSON data and improve file loading error handling
This commit is contained in:
@@ -333,13 +333,17 @@ describe('useGamemasterFiles', () => {
|
||||
});
|
||||
|
||||
it('should be true for large files', async () => {
|
||||
// Create a large string that will split into many lines
|
||||
const largeContent = Array(15000).fill('line').join('\n');
|
||||
mockClient.getPokemon.mockResolvedValueOnce(largeContent);
|
||||
// Create large array that when JSON stringified will have many lines
|
||||
const largeData = {
|
||||
items: Array(12000).fill({ id: 1, data: 'test' })
|
||||
};
|
||||
mockClient.getPokemon.mockResolvedValueOnce(largeData);
|
||||
composable.selectedFile.value = 'pokemon';
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user