Skip to content

Commit

Permalink
Merge branch 'testMaster' of https://github.com/ftoromanoff/itowns in…
Browse files Browse the repository at this point in the history
…to testMaster
  • Loading branch information
ftoromanoff committed Dec 18, 2023
2 parents 5599b10 + 1ddc47f commit c0b79b8
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions test/unit/entwine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,41 @@ import Coordinates from 'Core/Geographic/Coordinates';
import EntwinePointTileSource from 'Source/EntwinePointTileSource';
import EntwinePointTileLayer from 'Layer/EntwinePointTileLayer';
import EntwinePointTileNode from 'Core/EntwinePointTileNode';
import sinon from 'sinon';
import Fetcher from 'Provider/Fetcher';
import Renderer from './bootstrap';

import ept from '../data/unitTest/entwine/ept.json';
import eptHierarchy from '../data/unitTest/entwine/ept-hierarchy/0-0-0-0.json';

const urlEpt = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine/ept.json';
const urlEptHierarchy = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine/ept-hierarchy/0-0-0-0.json';

const resources = {
[urlEpt]: ept,
[urlEptHierarchy]: eptHierarchy,
};

describe('Entwine Point Tile', function () {
const source = new EntwinePointTileSource({
// url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine',
url: 'test/data/unitTest/entwine',
networkOptions: process.env.HTTPS_PROXY ? { agent: new HttpsProxyAgent(process.env.HTTPS_PROXY) } : {},
let source;
let stubFetcherJson;
let stubFetcherArrayBuf;

before(function () {
stubFetcherJson = sinon.stub(Fetcher, 'json')
.callsFake(url => Promise.resolve(JSON.parse(resources[url])));
stubFetcherArrayBuf = sinon.stub(Fetcher, 'arrayBuffer')
.callsFake(() => Promise.resolve(new ArrayBuffer(8).buffer));

source = new EntwinePointTileSource({
url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/entwine',
networkOptions: process.env.HTTPS_PROXY ? { agent: new HttpsProxyAgent(process.env.HTTPS_PROXY) } : {},
});
});

after(function () {
stubFetcherJson.restore();
stubFetcherArrayBuf.restore();
});

it('loads the EPT structure', (done) => {
Expand Down

0 comments on commit c0b79b8

Please sign in to comment.