-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
846499d
commit 7a685ba
Showing
2 changed files
with
52 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,67 @@ | ||
import { expect } from "chai"; | ||
import { expect } from 'chai'; | ||
import { | ||
execute, | ||
getServicePoint, | ||
searchGroup, | ||
searchIndividual, | ||
} from "../src/Adaptor.js"; | ||
} from '../src/Adaptor.js'; | ||
|
||
const state = { | ||
configuration: { | ||
username: "admin", | ||
password: "admin", | ||
baseUrl: "https://demo.openspp.org/", | ||
database: "openspp_adaptor", | ||
username: 'admin', | ||
password: 'admin', | ||
baseUrl: 'https://demo.openspp.org/', | ||
database: 'openspp_adaptor', | ||
}, | ||
references: [], | ||
}; | ||
|
||
describe("execute", () => { | ||
it("executes each operation in sequence", done => { | ||
const operations = [ | ||
state => { | ||
return { counter: 1 }; | ||
}, | ||
state => { | ||
return { counter: 2 }; | ||
}, | ||
state => { | ||
return { counter: 3 }; | ||
}, | ||
]; | ||
// Unit tests are disabled here because they run against a live sandbox | ||
// They should be re-enabled for local dev when this adaptor is next touched | ||
describe.skip('openspp', () => { | ||
describe('execute', () => { | ||
it('executes each operation in sequence', done => { | ||
const operations = [ | ||
state => { | ||
return { counter: 1 }; | ||
}, | ||
state => { | ||
return { counter: 2 }; | ||
}, | ||
state => { | ||
return { counter: 3 }; | ||
}, | ||
]; | ||
|
||
execute(...operations)(state) | ||
.then(finalState => { | ||
expect(finalState).to.eql({ counter: 3 }); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
execute(...operations)(state) | ||
.then(finalState => { | ||
expect(finalState).to.eql({ counter: 3 }); | ||
}) | ||
.then(done) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("getServicePoint", () => { | ||
it("get non-existing service point from demo server", async () => { | ||
let finalState = await getServicePoint("n0n-3x15t1n6-53rv1c3-p01nt")(state); | ||
expect(finalState.data).to.be.undefined; | ||
describe('getServicePoint', () => { | ||
it('get non-existing service point from demo server', async () => { | ||
let finalState = await getServicePoint('n0n-3x15t1n6-53rv1c3-p01nt')( | ||
state | ||
); | ||
expect(finalState.data).to.be.undefined; | ||
}); | ||
}); | ||
}); | ||
|
||
describe("searchGroup", () => { | ||
it("search non-existing group from demo server", async () => { | ||
let finalState = await searchGroup([["id", "=", -1]])(state); | ||
expect(finalState.data).to.be.undefined; | ||
describe('searchGroup', () => { | ||
it('search non-existing group from demo server', async () => { | ||
let finalState = await searchGroup([['id', '=', -1]])(state); | ||
expect(finalState.data).to.be.undefined; | ||
}); | ||
}); | ||
}); | ||
|
||
describe("searchIndividual", () => { | ||
it("search non-existing individual from demo server", async () => { | ||
let finalState = await searchIndividual([["id", "=", -1]])(state); | ||
expect(finalState.data).to.be.undefined; | ||
describe('searchIndividual', () => { | ||
it('search non-existing individual from demo server', async () => { | ||
let finalState = await searchIndividual([['id', '=', -1]])(state); | ||
expect(finalState.data).to.be.undefined; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
getServicePoint("Agent 1"); | ||
searchGroup([["name", "ilike", "test group"]]); | ||
searchIndividual([["name", "ilike", "butt"]]); | ||
getGroup("GRP_7NAAH42X"); | ||
getIndividual("IND_EJFW8GUQ"); | ||
getProgram("PROG_2023_00000128"); | ||
getServicePoint('Agent 1'); | ||
searchGroup([['name', 'ilike', 'test group']]); | ||
searchIndividual([['name', 'ilike', 'plants']]); | ||
getGroup('GRP_7NAAH42X'); | ||
getIndividual('IND_EJFW8GUQ'); | ||
getProgram('PROG_2023_00000128'); |