diff --git a/test/unit/fetcher.js b/test/unit/fetcher.js index 10a0d46e1c..29d90de29e 100644 --- a/test/unit/fetcher.js +++ b/test/unit/fetcher.js @@ -3,11 +3,12 @@ import { HttpsProxyAgent } from 'https-proxy-agent'; import Fetcher from 'Provider/Fetcher'; import { DataTexture, Texture } from 'three'; +const itownsdataUrl = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master'; + describe('Fetcher', function () { const networkOptions = process.env.HTTPS_PROXY ? { agent: new HttpsProxyAgent(process.env.HTTPS_PROXY) } : {}; describe('text', function () { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'altitude-conversion-grids/EGM2008.gdf'; + const url = `${itownsdataUrl}/altitude-conversion-grids/EGM2008.gdf`; it('should load a text file', (done) => { Fetcher.text(url, networkOptions) .then((text) => { @@ -21,8 +22,7 @@ describe('Fetcher', function () { .catch(done); }); it('should fail [test checkResponse()]', (done) => { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'noFile.txt'; + const url = `${itownsdataUrl}/noFile.txt`; let res; Fetcher.text(url, networkOptions) .then((text) => { @@ -42,8 +42,7 @@ describe('Fetcher', function () { }); describe('json', function () { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'immersive/exampleParis1/cameraCalibration.json'; + const url = `${itownsdataUrl}/immersive/exampleParis1/cameraCalibration.json`; it('should load a json file', (done) => { Fetcher.json(url, networkOptions) .then((json) => { @@ -56,8 +55,7 @@ describe('Fetcher', function () { }); describe('xml', function () { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'ULTRA2009.gpx'; + const url = `${itownsdataUrl}/ULTRA2009.gpx`; it('should load a xml file', (done) => { Fetcher.xml(url, networkOptions) .then((xml) => { @@ -87,8 +85,7 @@ describe('Fetcher', function () { }); describe('arrayBuffer', function () { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'altitude-conversion-grids/RAF20_float.gtx'; + const url = `${itownsdataUrl}/altitude-conversion-grids/RAF20_float.gtx`; it('should load a json file', (done) => { Fetcher.arrayBuffer(url, networkOptions) .then((buffer) => { @@ -126,8 +123,7 @@ describe('Fetcher', function () { }); describe('multiple', function () { - const url = 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/' + - 'vrt/velib-disponibilite-en-temps-reel'; + const url = `${itownsdataUrl}/vrt/velib-disponibilite-en-temps-reel`; const extension = { xml: ['vrt'], text: ['csv'],