mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
fix unit tests
This commit is contained in:
parent
ff32ad5c34
commit
8c44ea1ea1
@ -5,4 +5,7 @@ module.exports = {
|
|||||||
coverageProvider: "v8",
|
coverageProvider: "v8",
|
||||||
setupFiles: ["jest-canvas-mock", "jest-webgl-canvas-mock"],
|
setupFiles: ["jest-canvas-mock", "jest-webgl-canvas-mock"],
|
||||||
testEnvironment: "jsdom",
|
testEnvironment: "jsdom",
|
||||||
|
setupFilesAfterEnv: [
|
||||||
|
"./tests/setupTests.js"
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
import { Extent } from '../src/og/Extent';
|
import { Extent } from '../src/og/Extent';
|
||||||
import { Worker } from './worker';
|
|
||||||
import { JSDOM } from 'jsdom';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
|
|
||||||
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
|
||||||
global.document = dom.window.document;
|
|
||||||
global.window = dom.window;
|
|
||||||
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
test('Testing Extent', () => {
|
test('Testing Extent', () => {
|
||||||
const extent = new Extent();
|
const extent = new Extent();
|
||||||
@ -17,4 +7,4 @@ test('Testing Extent', () => {
|
|||||||
Extent.NORTH_POLE_DEG;
|
Extent.NORTH_POLE_DEG;
|
||||||
Extent.SOUTH_POLE_DEG;
|
Extent.SOUTH_POLE_DEG;
|
||||||
expect(extent).toBeTruthy();
|
expect(extent).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
import { Globe } from '../src/og/Globe';
|
import { Globe } from '../src/og/Globe';
|
||||||
import { Worker } from './worker';
|
|
||||||
import { JSDOM } from 'jsdom';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
|
|
||||||
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
|
||||||
global.document = dom.window.document;
|
|
||||||
global.window = dom.window;
|
|
||||||
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
test('Testing Globe', () => {
|
test('Testing Globe', () => {
|
||||||
const globe = new Globe({ target: 'div' });
|
const globe = new Globe({ target: 'div' });
|
||||||
expect(globe).toBeTruthy();
|
expect(globe).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
import { Extent } from '../src/og/Extent';
|
import { Extent } from '../src/og/Extent';
|
||||||
import { Planet } from '../src/og/scene/Planet';
|
import { Planet } from '../src/og/scene/Planet';
|
||||||
import { SegmentLonLat } from '../src/og/segment/SegmentLonLat';
|
import { SegmentLonLat } from '../src/og/segment/SegmentLonLat';
|
||||||
import { Worker } from './worker';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
const mockPlanet = () => {
|
const mockPlanet = () => {
|
||||||
const planet = new Planet();
|
const planet = new Planet();
|
||||||
@ -16,4 +12,4 @@ const mockPlanet = () => {
|
|||||||
test('Testing SegmentLonLat', () => {
|
test('Testing SegmentLonLat', () => {
|
||||||
const segmentLonLat = new SegmentLonLat({}, mockPlanet(), {}, new Extent());
|
const segmentLonLat = new SegmentLonLat({}, mockPlanet(), {}, new Extent());
|
||||||
expect(segmentLonLat).toBeTruthy();
|
expect(segmentLonLat).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,6 +10,4 @@ test('Testing Billboard', () => {
|
|||||||
billboard.setHeight(200);
|
billboard.setHeight(200);
|
||||||
billboard.setWidth(200);
|
billboard.setWidth(200);
|
||||||
expect(billboard.getSize()).toStrictEqual({ 'width': 200, 'height': 200 });
|
expect(billboard.getSize()).toStrictEqual({ 'width': 200, 'height': 200 });
|
||||||
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
import { Material } from '../../src/og/layer/Material';
|
import { Material } from '../../src/og/layer/Material';
|
||||||
import { Worker } from '../worker';
|
|
||||||
import { JSDOM } from 'jsdom';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
|
|
||||||
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
|
||||||
global.document = dom.window.document;
|
|
||||||
global.window = dom.window;
|
|
||||||
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
test('Testing Material', () => {
|
test('Testing Material', () => {
|
||||||
const material = new Material('name', {});
|
const material = new Material('name', {});
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
import { Vector } from '../../src/og/layer/Vector';
|
import { Vector } from '../../src/og/layer/Vector';
|
||||||
import { Worker } from '../worker';
|
|
||||||
import { JSDOM } from 'jsdom';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
|
|
||||||
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
|
||||||
global.document = dom.window.document;
|
|
||||||
global.window = dom.window;
|
|
||||||
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
test('Testing Vector', () => {
|
test('Testing Vector', () => {
|
||||||
const vector = new Vector('name', {});
|
const vector = new Vector('name', {});
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
import { XYZ } from '../../src/og/layer/XYZ';
|
import { XYZ } from '../../src/og/layer/XYZ';
|
||||||
import { Worker } from '../worker';
|
|
||||||
import { JSDOM } from 'jsdom';
|
|
||||||
|
|
||||||
window.Worker = Worker;
|
|
||||||
|
|
||||||
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
|
||||||
global.document = dom.window.document;
|
|
||||||
global.window = dom.window;
|
|
||||||
|
|
||||||
global.URL.createObjectURL = jest.fn(() => '');
|
|
||||||
|
|
||||||
test('Testing Extent', () => {
|
test('Testing Extent', () => {
|
||||||
const xyz = new XYZ('name', {});
|
const xyz = new XYZ('name', {});
|
||||||
|
|||||||
11
tests/setupTests.js
Normal file
11
tests/setupTests.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import 'regenerator-runtime/runtime'
|
||||||
|
import { Worker } from './worker';
|
||||||
|
import { JSDOM } from 'jsdom';
|
||||||
|
|
||||||
|
window.Worker = Worker;
|
||||||
|
|
||||||
|
const dom = new JSDOM('<html><div id="globus_viewport_0"></p>');
|
||||||
|
global.document = dom.window.document;
|
||||||
|
global.window = dom.window;
|
||||||
|
|
||||||
|
global.URL.createObjectURL = jest.fn(() => '');
|
||||||
Loading…
x
Reference in New Issue
Block a user