Fixed tests

Summary: Fixed few tests which were failing on Windows

Reviewed By: mweststrate

Differential Revision: D19371105

fbshipit-source-id: 118a76783680a3efa0645321d8c88b4e6e754ce0
This commit is contained in:
Anton Nikolaev
2020-01-13 06:20:54 -08:00
committed by Facebook Github Bot
parent 294a400428
commit 7da7df44ff
3 changed files with 12 additions and 10 deletions

View File

@@ -19,9 +19,10 @@ export interface BaseIdler {
export class Idler implements BaseIdler {
private lastIdle = performance.now();
private interval = 16;
private kill = false;
constructor(private interval = 16) {}
shouldIdle(): boolean {
return this.kill || performance.now() - this.lastIdle > this.interval;
}

View File

@@ -30,7 +30,7 @@ test('Idler should interrupt', async () => {
});
test('Idler should want to idle', async () => {
const idler = new Idler();
const idler = new Idler(100);
expect(idler.shouldIdle()).toBe(false);
await sleep(10);
expect(idler.shouldIdle()).toBe(false);

View File

@@ -8,27 +8,28 @@
*/
import {buildLocalIconPath, buildIconURL} from '../icons';
import * as path from 'path';
test('filled icons get correct local path', () => {
const path = buildLocalIconPath('star', 12, 2);
expect(path).toBe('icons/star-filled-12@2x.png');
const iconPath = buildLocalIconPath('star', 12, 2);
expect(iconPath).toBe(path.join('icons', 'star-filled-12@2x.png'));
});
test('outline icons get correct local path', () => {
const path = buildLocalIconPath('star-outline', 12, 2);
expect(path).toBe('icons/star-outline-12@2x.png');
const iconPath = buildLocalIconPath('star-outline', 12, 2);
expect(iconPath).toBe(path.join('icons', 'star-outline-12@2x.png'));
});
test('filled icons get correct URL', () => {
const path = buildIconURL('star', 12, 2);
expect(path).toBe(
const iconUrl = buildIconURL('star', 12, 2);
expect(iconUrl).toBe(
'https://external.xx.fbcdn.net/assets/?name=star&variant=filled&size=12&set=facebook_icons&density=2x',
);
});
test('outline icons get correct URL', () => {
const path = buildIconURL('star-outline', 12, 2);
expect(path).toBe(
const iconUrl = buildIconURL('star-outline', 12, 2);
expect(iconUrl).toBe(
'https://external.xx.fbcdn.net/assets/?name=star&variant=outline&size=12&set=facebook_icons&density=2x',
);
});