diff --git a/src/main/server/adapter/case/case.test.js b/src/main/server/adapter/case/case.test.js index 5080b7929..b52b653cd 100644 --- a/src/main/server/adapter/case/case.test.js +++ b/src/main/server/adapter/case/case.test.js @@ -19,7 +19,7 @@ describe("CASE Adapter", function() { before(async ()=>{ try{ - await fetch("http://localhost/api/data/70d27b782c062d1280b240890141dcf6"); + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}data/70d27b782c062d1280b240890141dcf6`); } catch(err){ let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-07c25f74-9119-11e8-b852-782bcb5df6ac")).json(); @@ -30,10 +30,10 @@ describe("CASE Adapter", function() { }); it('conversion to CASE', async () => { - await fetch("http://localhost/api/ims/case/v1p0/CFPackages/70d27b782c062d1280b240890141dcf6") + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ims/case/v1p0/CFPackages/70d27b782c062d1280b240890141dcf6`) }).timeout(10000); it('ACT Collective Problem Solving import', async()=>{ - await fetch("http://localhost/api/ims/case/harvest?caseEndpoint=https://opensalt.net&dId=f0e7396a-7edd-11e9-86d4-23cb22a51e7e") + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ims/case/harvest?caseEndpoint=https://opensalt.net&dId=f0e7396a-7edd-11e9-86d4-23cb22a51e7e`) }).timeout(30000); }); \ No newline at end of file diff --git a/src/main/server/adapter/ceasn/ceasn.test.js b/src/main/server/adapter/ceasn/ceasn.test.js index 1989b133d..37f436444 100644 --- a/src/main/server/adapter/ceasn/ceasn.test.js +++ b/src/main/server/adapter/ceasn/ceasn.test.js @@ -24,41 +24,40 @@ describe("CEASN Adapter", function() { this.timeout(30000); before(async ()=>{ - try{ - await fetch("http://localhost/api/data/70d27b782c062d1280b240890141dcf6"); - } - catch(err){ + try { + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}data/70d27b782c062d1280b240890141dcf6`); + } catch (err) { console.log('doing things'); let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-07c25f74-9119-11e8-b852-782bcb5df6ac")).json(); console.log('onet', onet); const formData = new FormData(); - formData.append('data',JSON.stringify(onet)); - await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData}); + formData.append('data', JSON.stringify(onet)); + await fetch("http://localhost/api/ctdlasn", {method: 'POST', body: formData}); } }); it('conversion to CEASN', async () => { - await fetch("http://localhost/api/ceasn/70d27b782c062d1280b240890141dcf6") + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ceasn/70d27b782c062d1280b240890141dcf6`) }).timeout(30000); - + it('conversion from CEASN', async () => { let repo = new EcRepository(); - repo.selectedServer = "http://localhost/api/"; + repo.selectedServer = process.env.CASS_LOOPBACK || "http://localhost/api/"; let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-07c264d7-9119-11e8-b852-782bcb5df6ac")).json(); const formData = new FormData(); - formData.append('data',JSON.stringify(onet)); - await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData}); + formData.append('data', JSON.stringify(onet)); + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ctdlasn`, {method: 'POST', body: formData}); let framework = await EcRepository.get("https://www.onetcenter.org/ctdlasn/resources/ce-07c264d7-9119-11e8-b852-782bcb5df6ac"); assert(framework != null, "Framework saved to CaSS."); }).timeout(30000); it('conversion from CEASN (Technology Skills)', async () => { let repo = new EcRepository(); - repo.selectedServer = "http://localhost/api/"; + repo.selectedServer = process.env.CASS_LOOPBACK || "http://localhost/api/"; let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-9fab4187-d8e7-11e9-8250-782bcb5df6ac")).json(); const formData = new FormData(); - formData.append('data',JSON.stringify(onet)); - await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData}); + formData.append('data', JSON.stringify(onet)); + await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ctdlasn`, {method: 'POST', body: formData}); let framework = await EcRepository.get("https://www.onetcenter.org/ctdlasn/resources/ce-9fab4187-d8e7-11e9-8250-782bcb5df6ac"); assert(framework != null, "Framework saved to CaSS."); }).timeout(300000); diff --git a/src/main/server/skyRepo.test.js b/src/main/server/skyRepo.test.js index d6de088c1..751477b83 100644 --- a/src/main/server/skyRepo.test.js +++ b/src/main/server/skyRepo.test.js @@ -23,7 +23,7 @@ describe('SkyRepo Adapter', function() { it('Server Move', async () => { // Initial creation. const repo1 = new EcRepository(); - await repo1.init('http://localhost/api/'); + await repo1.init(process.env.CASS_LOOPBACK || "http://localhost/api/"); const thing = new schema.Thing(); thing.name = 'A thing.'; thing.generateId(repo1.selectedServer); @@ -33,7 +33,7 @@ describe('SkyRepo Adapter', function() { // Wipe and create second repo link to alternate url. EcRepository.repos = []; const repo2 = new EcRepository(); - await repo2.init('http://127.0.0.1/api/'); + await repo2.init(process.env.CASS_LOOPBACK || `http://127.0.0.1:${PORT}/api/`); // Get from repo2. Falls back to search (in error case); const thingCopy2 = await EcRepository.get(canonicalUrl); @@ -59,7 +59,7 @@ describe('SkyRepo Adapter', function() { it('Multiput', async () => { const repo = new EcRepository(); - await repo.init('http://localhost/api/'); + await repo.init(process.env.CASS_LOOPBACK || "http://localhost/api/"); let thing1 = new schema.Thing(); thing1.generateId(repo.selectedServer);