Skip to content

Commit 622e294

Browse files
committed
WIP Test
1 parent c411fab commit 622e294

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

src/main/server/adapter/case/case.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("CASE Adapter", function() {
1919

2020
before(async ()=>{
2121
try{
22-
await fetch("http://localhost/api/data/70d27b782c062d1280b240890141dcf6");
22+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}data/70d27b782c062d1280b240890141dcf6`);
2323
}
2424
catch(err){
2525
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() {
3030
});
3131

3232
it('conversion to CASE', async () => {
33-
await fetch("http://localhost/api/ims/case/v1p0/CFPackages/70d27b782c062d1280b240890141dcf6")
33+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ims/case/v1p0/CFPackages/70d27b782c062d1280b240890141dcf6`)
3434
}).timeout(10000);
3535

3636
it('ACT Collective Problem Solving import', async()=>{
37-
await fetch("http://localhost/api/ims/case/harvest?caseEndpoint=https://opensalt.net&dId=f0e7396a-7edd-11e9-86d4-23cb22a51e7e")
37+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ims/case/harvest?caseEndpoint=https://opensalt.net&dId=f0e7396a-7edd-11e9-86d4-23cb22a51e7e`)
3838
}).timeout(30000);
3939
});

src/main/server/adapter/ceasn/ceasn.test.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,40 @@ describe("CEASN Adapter", function() {
2424
this.timeout(30000);
2525

2626
before(async ()=>{
27-
try{
28-
await fetch("http://localhost/api/data/70d27b782c062d1280b240890141dcf6");
29-
}
30-
catch(err){
27+
try {
28+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}data/70d27b782c062d1280b240890141dcf6`);
29+
} catch (err) {
3130
console.log('doing things');
3231
let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-07c25f74-9119-11e8-b852-782bcb5df6ac")).json();
3332
console.log('onet', onet);
3433
const formData = new FormData();
35-
formData.append('data',JSON.stringify(onet));
36-
await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData});
34+
formData.append('data', JSON.stringify(onet));
35+
await fetch("http://localhost/api/ctdlasn", {method: 'POST', body: formData});
3736
}
3837
});
3938

4039
it('conversion to CEASN', async () => {
41-
await fetch("http://localhost/api/ceasn/70d27b782c062d1280b240890141dcf6")
40+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ceasn/70d27b782c062d1280b240890141dcf6`)
4241
}).timeout(30000);
43-
42+
4443
it('conversion from CEASN', async () => {
4544
let repo = new EcRepository();
46-
repo.selectedServer = "http://localhost/api/";
45+
repo.selectedServer = process.env.CASS_LOOPBACK || "http://localhost/api/";
4746
let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-07c264d7-9119-11e8-b852-782bcb5df6ac")).json();
4847
const formData = new FormData();
49-
formData.append('data',JSON.stringify(onet));
50-
await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData});
48+
formData.append('data', JSON.stringify(onet));
49+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ctdlasn`, {method: 'POST', body: formData});
5150
let framework = await EcRepository.get("https://www.onetcenter.org/ctdlasn/resources/ce-07c264d7-9119-11e8-b852-782bcb5df6ac");
5251
assert(framework != null, "Framework saved to CaSS.");
5352
}).timeout(30000);
5453

5554
it('conversion from CEASN (Technology Skills)', async () => {
5655
let repo = new EcRepository();
57-
repo.selectedServer = "http://localhost/api/";
56+
repo.selectedServer = process.env.CASS_LOOPBACK || "http://localhost/api/";
5857
let onet = await (await fetch("https://www.onetcenter.org/ctdlasn/graph/ce-9fab4187-d8e7-11e9-8250-782bcb5df6ac")).json();
5958
const formData = new FormData();
60-
formData.append('data',JSON.stringify(onet));
61-
await fetch("http://localhost/api/ctdlasn",{method: 'POST', body: formData});
59+
formData.append('data', JSON.stringify(onet));
60+
await fetch(`${process.env.CASS_LOOPBACK || "http://localhost/api/"}ctdlasn`, {method: 'POST', body: formData});
6261
let framework = await EcRepository.get("https://www.onetcenter.org/ctdlasn/resources/ce-9fab4187-d8e7-11e9-8250-782bcb5df6ac");
6362
assert(framework != null, "Framework saved to CaSS.");
6463
}).timeout(300000);

src/main/server/skyRepo.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('SkyRepo Adapter', function() {
2323
it('Server Move', async () => {
2424
// Initial creation.
2525
const repo1 = new EcRepository();
26-
await repo1.init('http://localhost/api/');
26+
await repo1.init(process.env.CASS_LOOPBACK || "http://localhost/api/");
2727
const thing = new schema.Thing();
2828
thing.name = 'A thing.';
2929
thing.generateId(repo1.selectedServer);
@@ -33,7 +33,7 @@ describe('SkyRepo Adapter', function() {
3333
// Wipe and create second repo link to alternate url.
3434
EcRepository.repos = [];
3535
const repo2 = new EcRepository();
36-
await repo2.init('http://127.0.0.1/api/');
36+
await repo2.init(process.env.CASS_LOOPBACK || `http://127.0.0.1:${PORT}/api/`);
3737

3838
// Get from repo2. Falls back to search (in error case);
3939
const thingCopy2 = await EcRepository.get(canonicalUrl);
@@ -59,7 +59,7 @@ describe('SkyRepo Adapter', function() {
5959

6060
it('Multiput', async () => {
6161
const repo = new EcRepository();
62-
await repo.init('http://localhost/api/');
62+
await repo.init(process.env.CASS_LOOPBACK || "http://localhost/api/");
6363

6464
let thing1 = new schema.Thing();
6565
thing1.generateId(repo.selectedServer);

0 commit comments

Comments
 (0)