Cleanup tests
authorFrank Bessou <frank.bessou@logilab.fr>
Fri, 07 Apr 2017 15:28:19 +0200
changeset 99 6c5e7ccfd728
parent 98 ef210fee86cc
child 100 13ff8842ff33
Cleanup tests - Fix indenting - Use baseUrl where possible
test/index.js
--- a/test/index.js	Fri Apr 07 15:22:27 2017 +0200
+++ b/test/index.js	Fri Apr 07 15:28:19 2017 +0200
@@ -430,7 +430,7 @@
             .callsFake( _ =>
                     Promise.resolve(new Response(JSON.stringify(remoteResource.schema), options)));
             fakeFetch.callsFake( _ => Promise.resolve(new Response(JSON.stringify(remoteResource.data), dataOptions)));
-            api = new Api('http://example.com', fakeFetch);
+            api = new Api(baseUrl, fakeFetch);
         });
 
         it('should fetch schema', done => {
@@ -487,22 +487,22 @@
 
             fakeFetch.withArgs(sinon.match(/\/foo\/123\/schema$/), sinon.match({}))
                     .resolves(new Response(schemaJson, options));
-            api = new Api('http://example.com', fakeFetch);
+            api = new Api(baseUrl, fakeFetch);
         });
 
         it('should fetch the entity data', done => {
             api.getEntity(etype, eid).then( _ => {
 
-            const dataUrl = 'http://example.com/foo/123';
-            assert.calledWith(fakeFetch, dataUrl, sinon.match({}));
-            done();
+                const dataUrl = baseUrl + '/foo/123';
+                assert.calledWith(fakeFetch, dataUrl, sinon.match({}));
+                done();
             });
         });
 
         it('should fetch the entity schema', () => {
             api.getEntity(etype, eid);
 
-            const schemaUrl = 'http://example.com/foo/123/schema';
+            const schemaUrl = baseUrl + '/foo/123/schema';
             const initOptions = {headers: {Accept: 'application/schema+json'}};
             assert.calledWith(fakeFetch, schemaUrl, sinon.match(initOptions));
         });