🔧 Simplify and refactor test for large file handling by replacing mocked data with manual line array setup

This commit is contained in:
2026-01-29 03:26:15 +00:00
parent 69354f5b71
commit c99fdec60d

View File

@@ -325,18 +325,9 @@ describe('useGamemasterFiles', () => {
expect(composable.fileTooLarge.value).toBe(false); expect(composable.fileTooLarge.value).toBe(false);
}); });
it('should be true for large files', async () => { it('should compute correctly based on line count', () => {
// Create large array that when JSON stringified will have many lines // Manually set up a large line array
const largeData = { composable.fileLines.value = Array(15000).fill('line');
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); expect(composable.fileTooLarge.value).toBe(true);
}); });
}); });