|
8 | 8 |
|
9 | 9 | import {Generator, processNavigationUrls} from '../src/generator'; |
10 | 10 | import {AssetGroup} from '../src/in'; |
11 | | -import {MockFilesystem} from '../testing/mock'; |
| 11 | +import {HashTrackingMockFilesystem, MockFilesystem} from '../testing/mock'; |
12 | 12 |
|
13 | 13 | describe('Generator', () => { |
14 | 14 | beforeEach(() => spyOn(Date, 'now').and.returnValue(1234567890123)); |
@@ -355,6 +355,26 @@ describe('Generator', () => { |
355 | 355 | }); |
356 | 356 | }); |
357 | 357 |
|
| 358 | + it('doesn\'t exceed concurrency limit', async () => { |
| 359 | + const fileCount = 600; |
| 360 | + const files = [...Array(fileCount).keys()].reduce((acc: Record<string, string>, _, i) => { |
| 361 | + acc[`/test${i}.js`] = `This is a test ${i}`; |
| 362 | + return acc; |
| 363 | + }, {'/index.html': 'This is a test'}); |
| 364 | + const fs = new HashTrackingMockFilesystem(files); |
| 365 | + const gen = new Generator(fs, '/'); |
| 366 | + const config = await gen.process({ |
| 367 | + index: '/index.html', |
| 368 | + assetGroups: [{ |
| 369 | + name: 'test', |
| 370 | + resources: {files: ['/*.js']}, |
| 371 | + }], |
| 372 | + }); |
| 373 | + expect(fs.maxConcurrentHashings).toBeLessThanOrEqual(500); |
| 374 | + expect(fs.maxConcurrentHashings).toBeGreaterThan(1); |
| 375 | + expect(Object.keys((config as any).hashTable).length).toBe(fileCount); |
| 376 | + }); |
| 377 | + |
358 | 378 | describe('processNavigationUrls()', () => { |
359 | 379 | const customNavigationUrls = [ |
360 | 380 | 'https://host/positive/external/**', |
|
0 commit comments