Skip to content

Commit

Permalink
WIP Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomilar committed Oct 29, 2024
1 parent c411fab commit 622e294
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/main/server/adapter/case/case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});
27 changes: 13 additions & 14 deletions src/main/server/adapter/ceasn/ceasn.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/main/server/skyRepo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 622e294

Please sign in to comment.