Skip to content

Commit

Permalink
some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ctot-nondef committed Dec 22, 2022
1 parent e866ecb commit 8dfef18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export class Main {
}

/**
* gets setlist from solr
* @param mdsource
* gets setlist from defined mdsource
* @param {IMdsource} mdsource - mdsource object
*/
private fetchPages = async (mdsource: IMdsource): Promise<Array<Record<any, any>>> => {
console.log(`fetching metadata from ${mdsource.baseurl}.`);
Expand Down
12 changes: 12 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ describe("main", () => {
});
});
});
describe("getDescendantProp", () => {
context("when a valid object and path are passed", () => {
it("should return the requested value", async () => {
expect(await main.getDescendantProp({ test: { test2: [0, 1 , 2] }}, "test.test2[0]")).to.equal(0);
});
});
context("when an unavailable path is passed", () => {
it("should return the requested value", async () => {
expect(await main.getDescendantProp({ test: { }}, "test.test2[0]")).to.be.undefined;
});
});
});
});

0 comments on commit 8dfef18

Please sign in to comment.