-
Notifications
You must be signed in to change notification settings - Fork 28
/
test-loading-builds.js
56 lines (48 loc) · 2.02 KB
/
test-loading-builds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const test = require('flug');
const { serve } = require('srvd');
const puppeteer = require('puppeteer');
const { port } = serve({ debug: true, max: 9, port: 3000 });
const url2GeoTIFF = `http://localhost:${port}/data/example_4326.tif`;
test('Should Successfully Require Production Build in Node', async ({ eq }) => {
const geoblaze = require('./dist/geoblaze.node.min.js');
eq(typeof geoblaze, "object");
const georaster = await geoblaze.load(url2GeoTIFF);
const result = await geoblaze.median(georaster);
eq(result[0], 132);
eq(typeof geoblaze.stats, "function");
});
test('Should Successfully Load Production Build in the Browser', async ({ eq }) => {
const browser = await puppeteer.launch();
const url = `http://localhost:3000/test/test-production-build.html`;
const page = await browser.newPage();
await page.goto(url);
const result = await page.evaluate(() => window.promises.median);
eq(result[0], 132);
browser.close();
});
test('Should Successfully Load Lite Production Build in the Browser', async ({ eq }) => {
const browser = await puppeteer.launch();
const url = `http://localhost:3000/test/test-production-build-lite.html`;
const page = await browser.newPage();
await page.goto(url);
const result = await page.evaluate(() => window.promises.median);
eq(result[0], 132);
browser.close();
});
test('Should Successfully Require Development Build in Node', async ({ eq }) => {
const geoblaze = require('./dist/geoblaze.node.js');
eq(typeof geoblaze, "object");
const georaster = await geoblaze.load(url2GeoTIFF);
const result = await geoblaze.median(georaster);
eq(result[0], 132);
eq(typeof geoblaze.stats, "function");
});
test('Should Successfully Load Development Build in the Browser', async ({ eq }) => {
const browser = await puppeteer.launch();
const url = `http://localhost:3000/test/test-dev-build.html`;
const page = await browser.newPage();
await page.goto(url);
const result = await page.evaluate(() => window.promises.median);
eq(result[0], 132);
browser.close();
});