From 36ececa858a74239cca4f0f1b27eabc5036bded1 Mon Sep 17 00:00:00 2001 From: Hirako2000 Date: Thu, 30 Mar 2017 14:45:53 +0100 Subject: [PATCH] Moves all existing tests close to src #218 --- {test => src/components/__tests__}/components.spec.js | 2 +- {test/core => src/core/__tests__}/App.spec.js | 2 +- {test/core => src/core/__tests__}/Component.spec.js | 2 +- {test/core => src/core/__tests__}/Loop.spec.js | 2 +- {test/core => src/core/__tests__}/ModuleManager.spec.js | 6 +++--- {test => src/modules/__tests__}/modules.spec.js | 7 +++---- src/polyfill.js | 6 ++++++ test/polyfill.js | 5 ----- 8 files changed, 16 insertions(+), 16 deletions(-) rename {test => src/components/__tests__}/components.spec.js (97%) rename {test/core => src/core/__tests__}/App.spec.js (94%) rename {test/core => src/core/__tests__}/Component.spec.js (97%) rename {test/core => src/core/__tests__}/Loop.spec.js (89%) rename {test/core => src/core/__tests__}/ModuleManager.spec.js (94%) rename {test => src/modules/__tests__}/modules.spec.js (96%) delete mode 100644 test/polyfill.js diff --git a/test/components.spec.js b/src/components/__tests__/components.spec.js similarity index 97% rename from test/components.spec.js rename to src/components/__tests__/components.spec.js index 7bb7287ed..393b6dc3c 100644 --- a/test/components.spec.js +++ b/src/components/__tests__/components.spec.js @@ -1,4 +1,4 @@ -import * as WHS from '../src/index'; +import * as WHS from '../../index'; import {Mesh} from 'three'; const meshes = [ diff --git a/test/core/App.spec.js b/src/core/__tests__/App.spec.js similarity index 94% rename from test/core/App.spec.js rename to src/core/__tests__/App.spec.js index 94f2e49a4..6ba2732f4 100644 --- a/test/core/App.spec.js +++ b/src/core/__tests__/App.spec.js @@ -1,4 +1,4 @@ -import * as WHS from '../../src/index'; +import * as WHS from '../../index'; /* * Ignored methods: diff --git a/test/core/Component.spec.js b/src/core/__tests__/Component.spec.js similarity index 97% rename from test/core/Component.spec.js rename to src/core/__tests__/Component.spec.js index 029a6556e..117cd8192 100644 --- a/test/core/Component.spec.js +++ b/src/core/__tests__/Component.spec.js @@ -1,4 +1,4 @@ -import * as WHS from '../../src/index'; +import * as WHS from '../../index'; /* * Ignored methods: diff --git a/test/core/Loop.spec.js b/src/core/__tests__/Loop.spec.js similarity index 89% rename from test/core/Loop.spec.js rename to src/core/__tests__/Loop.spec.js index 6b5ce9ccf..901a5401f 100644 --- a/test/core/Loop.spec.js +++ b/src/core/__tests__/Loop.spec.js @@ -1,4 +1,4 @@ -import * as WHS from '../../src/index'; +import * as WHS from '../index'; const app = new WHS.App(); const loop = new WHS.Loop(() => {}, false); diff --git a/test/core/ModuleManager.spec.js b/src/core/__tests__/ModuleManager.spec.js similarity index 94% rename from test/core/ModuleManager.spec.js rename to src/core/__tests__/ModuleManager.spec.js index 529068da6..80463199a 100644 --- a/test/core/ModuleManager.spec.js +++ b/src/core/__tests__/ModuleManager.spec.js @@ -1,4 +1,4 @@ -import * as WHS from '../../src/index'; +import * as WHS from '../../index'; /* * Ignored methods: @@ -41,7 +41,7 @@ test('.set()', () => { expect(manager.store.overwritable[0]).toBe('newValue'); }); -test('.update()', async () => { +test('.update()', () => { const update = new Promise((resolve, reject) => { manager.update({ overwritable: () => { @@ -54,7 +54,7 @@ test('.update()', async () => { manager.set('overwritable', 'check update'); - expect(await update).toBeTruthy(); + expect(update).toBeTruthy(); }); test('.has()', () => { diff --git a/test/modules.spec.js b/src/modules/__tests__/modules.spec.js similarity index 96% rename from test/modules.spec.js rename to src/modules/__tests__/modules.spec.js index 39ba91cde..b7e009e9b 100644 --- a/test/modules.spec.js +++ b/src/modules/__tests__/modules.spec.js @@ -1,6 +1,6 @@ -import './polyfill'; -import * as WHS from '../src/index'; -import {FogModule} from '../src/modules/app/FogModule'; +import '../../polyfill'; +import * as WHS from '../../index'; +import {FogModule} from '../app/FogModule'; import gl from 'gl'; const app = new WHS.App(); @@ -40,7 +40,6 @@ test('VirtualMouseModule', () => { modules.mouse = new WHS.app.VirtualMouseModule(); }); - // TODO move Modules tests into individual specs const defaultFog = new FogModule(); test('FogModule', () => { diff --git a/src/polyfill.js b/src/polyfill.js index e8a14f820..a3e7a99b9 100644 --- a/src/polyfill.js +++ b/src/polyfill.js @@ -1,3 +1,9 @@ +import present from 'present'; + export const system = { window: typeof window === 'undefined' ? global : window }; + +global.performance = { + now: present +}; diff --git a/test/polyfill.js b/test/polyfill.js deleted file mode 100644 index 4d1102d8b..000000000 --- a/test/polyfill.js +++ /dev/null @@ -1,5 +0,0 @@ -import present from 'present'; - -global.performance = { - now: present -};