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:
committed by
Facebook Github Bot
parent
294a400428
commit
7da7df44ff
@@ -19,9 +19,10 @@ export interface BaseIdler {
|
|||||||
|
|
||||||
export class Idler implements BaseIdler {
|
export class Idler implements BaseIdler {
|
||||||
private lastIdle = performance.now();
|
private lastIdle = performance.now();
|
||||||
private interval = 16;
|
|
||||||
private kill = false;
|
private kill = false;
|
||||||
|
|
||||||
|
constructor(private interval = 16) {}
|
||||||
|
|
||||||
shouldIdle(): boolean {
|
shouldIdle(): boolean {
|
||||||
return this.kill || performance.now() - this.lastIdle > this.interval;
|
return this.kill || performance.now() - this.lastIdle > this.interval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ test('Idler should interrupt', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Idler should want to idle', async () => {
|
test('Idler should want to idle', async () => {
|
||||||
const idler = new Idler();
|
const idler = new Idler(100);
|
||||||
expect(idler.shouldIdle()).toBe(false);
|
expect(idler.shouldIdle()).toBe(false);
|
||||||
await sleep(10);
|
await sleep(10);
|
||||||
expect(idler.shouldIdle()).toBe(false);
|
expect(idler.shouldIdle()).toBe(false);
|
||||||
|
|||||||
@@ -8,27 +8,28 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {buildLocalIconPath, buildIconURL} from '../icons';
|
import {buildLocalIconPath, buildIconURL} from '../icons';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
test('filled icons get correct local path', () => {
|
test('filled icons get correct local path', () => {
|
||||||
const path = buildLocalIconPath('star', 12, 2);
|
const iconPath = buildLocalIconPath('star', 12, 2);
|
||||||
expect(path).toBe('icons/star-filled-12@2x.png');
|
expect(iconPath).toBe(path.join('icons', 'star-filled-12@2x.png'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('outline icons get correct local path', () => {
|
test('outline icons get correct local path', () => {
|
||||||
const path = buildLocalIconPath('star-outline', 12, 2);
|
const iconPath = buildLocalIconPath('star-outline', 12, 2);
|
||||||
expect(path).toBe('icons/star-outline-12@2x.png');
|
expect(iconPath).toBe(path.join('icons', 'star-outline-12@2x.png'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('filled icons get correct URL', () => {
|
test('filled icons get correct URL', () => {
|
||||||
const path = buildIconURL('star', 12, 2);
|
const iconUrl = buildIconURL('star', 12, 2);
|
||||||
expect(path).toBe(
|
expect(iconUrl).toBe(
|
||||||
'https://external.xx.fbcdn.net/assets/?name=star&variant=filled&size=12&set=facebook_icons&density=2x',
|
'https://external.xx.fbcdn.net/assets/?name=star&variant=filled&size=12&set=facebook_icons&density=2x',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('outline icons get correct URL', () => {
|
test('outline icons get correct URL', () => {
|
||||||
const path = buildIconURL('star-outline', 12, 2);
|
const iconUrl = buildIconURL('star-outline', 12, 2);
|
||||||
expect(path).toBe(
|
expect(iconUrl).toBe(
|
||||||
'https://external.xx.fbcdn.net/assets/?name=star&variant=outline&size=12&set=facebook_icons&density=2x',
|
'https://external.xx.fbcdn.net/assets/?name=star&variant=outline&size=12&set=facebook_icons&density=2x',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user