Skip to content

Commit

Permalink
missing mock test parts, styling
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelynJefferson committed Jul 2, 2024
1 parent 76de76e commit bdf167c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
34 changes: 16 additions & 18 deletions test/cache/DiskBasedPackageCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,21 @@ describe('DiskBasedPackageCache', () => {
});

describe('#getResourceAtPath', () => {
it('should return a resource with a given resource path'),
() => {
const rootPath = path.resolve(cacheFolder, 'fhir.small#0.1.0', 'package');
const totalPath = path.resolve(rootPath, 'StructureDefinition-MyPatient.json');
const resource = cache.getResourceAtPath(totalPath);
expect(resource).toBeDefined();
expect(resource.id).toBe('MyPatient');
expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
};
it('should return a resource with an xml path where xml was converted to a resource'),
() => {
const totalPath = path.resolve(local1Folder, 'StructureDefinition-true-false.xml');
const resource = cache.getResourceAtPath(totalPath);
expect(resource).toBeDefined();
expect(resource.id).toBe('true-false');
expect(resource.xml).toBeUndefined();
expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
};
it('should return a resource with a given resource path', () => {
const rootPath = path.resolve(cacheFolder, 'fhir.small#0.1.0', 'package');
const totalPath = path.resolve(rootPath, 'StructureDefinition-MyPatient.json');
const resource = cache.getResourceAtPath(totalPath);
expect(resource).toBeDefined();
expect(resource.id).toBe('MyPatient');
expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
});
it('should return a resource with an xml path where xml was converted to a resource', () => {
const totalPath = path.resolve(local1Folder, 'StructureDefinition-true-false.xml');
const resource = cache.getResourceAtPath(totalPath);
expect(resource).toBeDefined();
expect(resource.id).toBe('true-false');
expect(resource.xml).toBeUndefined();
expect(loggerSpy.getAllLogs('error')).toHaveLength(0);
});
});
});
12 changes: 12 additions & 0 deletions test/registry/FHIRRegistryClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ describe('FHIRRegistryClient', () => {

describe('#download', () => {
describe('#downloadAnyVersion', () => {
beforeEach(() => {
loggerSpy.reset();
});
beforeAll(() => {
axiosSpy = jest.spyOn(axios, 'get').mockImplementation((uri: string): any => {
if (
Expand Down Expand Up @@ -146,6 +149,9 @@ describe('FHIRRegistryClient', () => {
});

describe('#downloadSpecificVersion', () => {
beforeEach(() => {
loggerSpy.reset();
});
beforeAll(() => {
axiosSpy = jest.spyOn(axios, 'get').mockImplementation((uri: string): any => {
if (
Expand Down Expand Up @@ -196,6 +202,9 @@ describe('FHIRRegistryClient', () => {
});

describe('#downloadLatestVersion', () => {
beforeEach(() => {
loggerSpy.reset();
});
beforeAll(() => {
axiosSpy = jest.spyOn(axios, 'get').mockImplementation((uri: string): any => {
if (
Expand Down Expand Up @@ -259,6 +268,9 @@ describe('FHIRRegistryClient', () => {
});

describe('#downloadLatestPatchVersion', () => {
beforeEach(() => {
loggerSpy.reset();
});
beforeAll(() => {
axiosSpy = jest.spyOn(axios, 'get').mockImplementation((uri: string): any => {
if (
Expand Down

0 comments on commit bdf167c

Please sign in to comment.