Skip to content

Commit

Permalink
Add tests for SQLJSPackageDB
Browse files Browse the repository at this point in the history
Test the save, find, stats, and clear class methods. No tests are added
for the logging methods.

Minor styling changes in some other files, as applied by prettier.
  • Loading branch information
mint-thompson committed Jul 18, 2024
1 parent 8c52186 commit 83d23a7
Show file tree
Hide file tree
Showing 5 changed files with 604 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/db/SQLJSPackageDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ export class SQLJSPackageDB implements PackageDB {
if (result.sdCharacteristics) {
result.sdCharacteristics = JSON.parse(result.sdCharacteristics);
}
if (result.sdAbstract != null) {
result.sdAbstract = result.sdAbstract ? true : false;
}
results.push(result as ResourceInfo);
}
stmt.free();
Expand Down
5 changes: 4 additions & 1 deletion src/errors/InvalidPackageError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export class InvalidPackageError extends Error {
constructor(public packagePath: string, public reason: string) {
constructor(
public packagePath: string,
public reason: string
) {
super(`The package at ${packagePath} is not a valid FHIR package: ${reason}.`);
}
}
5 changes: 4 additions & 1 deletion src/errors/InvalidResourceError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export class InvalidResourceError extends Error {
constructor(public resourcePath: string, public reason: string) {
constructor(
public resourcePath: string,
public reason: string
) {
super(`The resource at ${resourcePath} is not a valid FHIR resource: ${reason}.`);
}
}
5 changes: 4 additions & 1 deletion src/registry/RedundantRegistryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { RegistryClient, RegistryClientOptions } from './RegistryClient';

export class RedundantRegistryClient implements RegistryClient {
protected log: LogFunction;
constructor(private clients: RegistryClient[], options: RegistryClientOptions = {}) {
constructor(
private clients: RegistryClient[],
options: RegistryClientOptions = {}
) {
this.log = options.log ?? (() => {});
}

Expand Down
Loading

0 comments on commit 83d23a7

Please sign in to comment.