Skip to content

Commit

Permalink
Make test for SQLJSPackageDB.findResourceInfo stricter
Browse files Browse the repository at this point in the history
Check properties of the returned resource to make sure it matches one of
the expected results.

Remove unneeded comment from saveResourceInfo test.
  • Loading branch information
mint-thompson committed Aug 22, 2024
1 parent 9755b34 commit 54ac727
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/db/SQLJSPackageDB.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ describe('SQLJSPackageDB', () => {
packageVersion: '3.2.2'
})
);
// ?? do we want to turn it back into a boolean, or is leaving it as a 0 good enough
});
});

Expand Down Expand Up @@ -514,6 +513,18 @@ describe('SQLJSPackageDB', () => {
it('should return one resource when there is at least one match', () => {
const resource = packageDb.findResourceInfo('my-value-set');
expect(resource).toBeDefined();
// both valueSetThree and valueSetFour have a matching id,
// so either packageVersion is acceptable.
expect(resource).toEqual(
expect.objectContaining({
resourceType: 'ValueSet',
id: 'my-value-set',
url: 'http://example.org/ValueSets/my-value-set',
name: 'MyValueSet',
packageName: 'RegularPackage',
packageVersion: expect.stringMatching(/^(3\.2\.2|4\.5\.6)$/)
})
);
});

it('should return undefined when there are no matches', () => {
Expand Down

0 comments on commit 54ac727

Please sign in to comment.