mirror of https://github.com/iconify/api.git
chore: another attempt to fix tests in ci
This commit is contained in:
parent
ea5b283d19
commit
30af9d7c0b
|
|
@ -13,6 +13,12 @@ describe('Directory downloader', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delay() {
|
||||||
|
return new Promise((fulfill) => {
|
||||||
|
setTimeout(fulfill, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
test('Existing files', async () => {
|
test('Existing files', async () => {
|
||||||
// Create new instance
|
// Create new instance
|
||||||
const test = new TestDownloader('tests/fixtures');
|
const test = new TestDownloader('tests/fixtures');
|
||||||
|
|
@ -88,16 +94,19 @@ describe('Directory downloader', () => {
|
||||||
expect(test.contentLoaded).toBe(1);
|
expect(test.contentLoaded).toBe(1);
|
||||||
|
|
||||||
// Replace file
|
// Replace file
|
||||||
|
await delay();
|
||||||
await writeFile(dir + '/mdi.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
await writeFile(dir + '/mdi.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
||||||
expect(await test.checkForUpdate()).toBe(true);
|
expect(await test.checkForUpdate()).toBe(true);
|
||||||
expect(test.contentLoaded).toBe(2);
|
expect(test.contentLoaded).toBe(2);
|
||||||
|
|
||||||
// Touch file: should trigger update because file modification time changes
|
// Touch file: should trigger update because file modification time changes
|
||||||
|
await delay();
|
||||||
await writeFile(dir + '/mdi.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
await writeFile(dir + '/mdi.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
||||||
expect(await test.checkForUpdate()).toBe(true);
|
expect(await test.checkForUpdate()).toBe(true);
|
||||||
expect(test.contentLoaded).toBe(3);
|
expect(test.contentLoaded).toBe(3);
|
||||||
|
|
||||||
// Add new file
|
// Add new file
|
||||||
|
await delay();
|
||||||
await writeFile(dir + '/mdi-light.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
await writeFile(dir + '/mdi-light.json', await readFile('tests/fixtures/json/mdi-light.json'));
|
||||||
|
|
||||||
// Check for update
|
// Check for update
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue