Skip to content

Commit 18f1c04

Browse files
committed
Release vintasend-medplum@0.11.1
1 parent 8edfffc commit 18f1c04

10 files changed

Lines changed: 42 additions & 27 deletions

__tests__/types.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { MedplumStorageIdentifiers } from '../src/types';
2+
import { describe, it, expect } from 'vitest';
3+
24

35
describe('MedplumStorageIdentifiers', () => {
46
it('should extend StorageIdentifiers with Medplum fields', () => {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vintasend-medplum",
3-
"version": "0.11.0",
3+
"version": "0.11.1",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"@medplum/fhirtypes": "^5.1.1",
2424
"pdfmake": "^0.2.5",
2525
"pug": "^3.0.3",
26-
"vintasend": "^0.11.0"
26+
"vintasend": "^0.11.1"
2727
},
2828
"devDependencies": {
2929
"@biomejs/biome": "^2.4.5",

src/__tests__/medplum-adapter-attachments.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
DatabaseNotification,
66
StoredAttachment,
77
} from 'vintasend';
8+
import { beforeEach, describe, expect, it, type Mocked, vi } from 'vitest';
89
import { MedplumNotificationAdapter } from '../medplum-adapter';
910
import type { MedplumNotificationBackend } from '../medplum-backend';
1011

@@ -22,8 +23,8 @@ import type { MedplumNotificationBackend } from '../medplum-backend';
2223
*/
2324
describe('MedplumNotificationAdapter - Attachments', () => {
2425
let medplumClient: MockClient;
25-
let mockTemplateRenderer: vi.Mocked<BaseEmailTemplateRenderer<any>>;
26-
let mockBackend: vi.Mocked<MedplumNotificationBackend<any>>;
26+
let mockTemplateRenderer: Mocked<BaseEmailTemplateRenderer<any>>;
27+
let mockBackend: Mocked<MedplumNotificationBackend<any>>;
2728
let adapter: MedplumNotificationAdapter<typeof mockTemplateRenderer, any>;
2829
let mockNotification: DatabaseNotification<any>;
2930

@@ -33,11 +34,11 @@ describe('MedplumNotificationAdapter - Attachments', () => {
3334
mockTemplateRenderer = {
3435
render: vi.fn(),
3536
renderFromTemplateContent: vi.fn(),
36-
} as vi.Mocked<BaseEmailTemplateRenderer<any>>;
37+
} as Mocked<BaseEmailTemplateRenderer<any>>;
3738

3839
mockBackend = {
3940
getUserEmailFromNotification: vi.fn(),
40-
} as unknown as vi.Mocked<MedplumNotificationBackend<any>>;
41+
} as unknown as Mocked<MedplumNotificationBackend<any>>;
4142

4243
adapter = new MedplumNotificationAdapter(medplumClient, mockTemplateRenderer, false);
4344
adapter.injectBackend(mockBackend);

src/__tests__/medplum-adapter-one-off.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
DatabaseNotification,
55
DatabaseOneOffNotification,
66
} from 'vintasend';
7+
import { beforeEach, describe, expect, it, type Mocked, vi } from 'vitest';
78
import { MedplumNotificationAdapter } from '../medplum-adapter';
89
import type { MedplumNotificationBackend } from '../medplum-backend';
910

@@ -21,8 +22,8 @@ import type { MedplumNotificationBackend } from '../medplum-backend';
2122
*/
2223
describe('MedplumNotificationAdapter - One-Off Notifications', () => {
2324
let medplumClient: MockClient;
24-
let mockTemplateRenderer: vi.Mocked<BaseEmailTemplateRenderer<any>>;
25-
let mockBackend: vi.Mocked<MedplumNotificationBackend<any>>;
25+
let mockTemplateRenderer: Mocked<BaseEmailTemplateRenderer<any>>;
26+
let mockBackend: Mocked<MedplumNotificationBackend<any>>;
2627
let adapter: MedplumNotificationAdapter<typeof mockTemplateRenderer, any>;
2728

2829
let mockOneOffNotification: DatabaseOneOffNotification<any>;
@@ -34,11 +35,11 @@ describe('MedplumNotificationAdapter - One-Off Notifications', () => {
3435
mockTemplateRenderer = {
3536
render: vi.fn(),
3637
renderFromTemplateContent: vi.fn(),
37-
} as vi.Mocked<BaseEmailTemplateRenderer<any>>;
38+
} as Mocked<BaseEmailTemplateRenderer<any>>;
3839

3940
mockBackend = {
4041
getUserEmailFromNotification: vi.fn(),
41-
} as unknown as vi.Mocked<MedplumNotificationBackend<any>>;
42+
} as unknown as Mocked<MedplumNotificationBackend<any>>;
4243

4344
adapter = new MedplumNotificationAdapter(medplumClient, mockTemplateRenderer, false);
4445
adapter.injectBackend(mockBackend);

src/__tests__/medplum-adapter.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { MockClient } from '@medplum/mock';
22
import type { BaseEmailTemplateRenderer, DatabaseNotification } from 'vintasend';
3+
import { beforeEach, describe, expect, it, type Mocked, vi } from 'vitest';
34
import { MedplumNotificationAdapter } from '../medplum-adapter';
45
import type { MedplumNotificationBackend } from '../medplum-backend';
56

@@ -14,8 +15,8 @@ import type { MedplumNotificationBackend } from '../medplum-backend';
1415
*/
1516
describe('MedplumNotificationAdapter', () => {
1617
let medplumClient: MockClient;
17-
let mockTemplateRenderer: vi.Mocked<BaseEmailTemplateRenderer<any>>;
18-
let mockBackend: vi.Mocked<MedplumNotificationBackend<any>>;
18+
let mockTemplateRenderer: Mocked<BaseEmailTemplateRenderer<any>>;
19+
let mockBackend: Mocked<MedplumNotificationBackend<any>>;
1920
let adapter: MedplumNotificationAdapter<typeof mockTemplateRenderer, any>;
2021
let mockNotification: DatabaseNotification<any>;
2122

@@ -27,11 +28,11 @@ describe('MedplumNotificationAdapter', () => {
2728
mockTemplateRenderer = {
2829
render: vi.fn(),
2930
renderFromTemplateContent: vi.fn(),
30-
} as vi.Mocked<BaseEmailTemplateRenderer<any>>;
31+
} as Mocked<BaseEmailTemplateRenderer<any>>;
3132

3233
mockBackend = {
3334
getUserEmailFromNotification: vi.fn(),
34-
} as unknown as vi.Mocked<MedplumNotificationBackend<any>>;
35+
} as unknown as Mocked<MedplumNotificationBackend<any>>;
3536

3637
mockNotification = {
3738
id: '123',

src/__tests__/medplum-attachment-manager.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Binary, Media } from '@medplum/fhirtypes';
22
import { MockClient } from '@medplum/mock';
3+
import { beforeEach, describe, expect, it, vi } from 'vitest';
34
import { MedplumAttachmentManager } from '../medplum-attachment-manager';
45

56
type MediaWithId = Media & { id: string };

src/__tests__/medplum-backend-attachments.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Binary, Communication, Media } from '@medplum/fhirtypes';
22
import { MockClient } from '@medplum/mock';
33
import type { AttachmentFile, NotificationAttachment, NotificationType } from 'vintasend';
4+
import { beforeEach, describe, expect, it, vi } from 'vitest';
45
import { MedplumNotificationBackend } from '../medplum-backend';
56

67
type TestContexts = {

src/__tests__/medplum-backend.test.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
BaseNotificationTypeConfig,
66
NotificationFilter,
77
} from 'vintasend';
8+
import { beforeEach, describe, expect, it, type Mocked, vi } from 'vitest';
89
import { MedplumNotificationBackend } from '../medplum-backend';
910

1011
interface TestConfig extends BaseNotificationTypeConfig {
@@ -19,7 +20,7 @@ interface TestConfig extends BaseNotificationTypeConfig {
1920

2021
describe('MedplumNotificationBackend', () => {
2122
let medplumClient: MockClient;
22-
let mockAttachmentManager: vi.Mocked<BaseAttachmentManager>;
23+
let mockAttachmentManager: Mocked<BaseAttachmentManager>;
2324
let backend: MedplumNotificationBackend<TestConfig>;
2425

2526
beforeEach(() => {
@@ -32,7 +33,7 @@ describe('MedplumNotificationBackend', () => {
3233
detectContentType: vi.fn(),
3334
calculateChecksum: vi.fn(),
3435
fileToBuffer: vi.fn(),
35-
} as unknown as vi.Mocked<BaseAttachmentManager>;
36+
} as unknown as Mocked<BaseAttachmentManager>;
3637

3738
backend = new MedplumNotificationBackend(medplumClient, {
3839
emailNotificationSubjectExtensionUrl:
@@ -565,7 +566,8 @@ describe('MedplumNotificationBackend', () => {
565566
it('should correctly serialize regular notification', () => {
566567
const mockCommunication = createMockCommunication({ id: '123' });
567568

568-
const result = backend.mapToDatabaseNotification(mockCommunication as any);
569+
// biome-ignore lint/complexity/useLiteralKeys: Testing private method directly for coverage - can ignore complexity here
570+
const result = backend['mapToDatabaseNotification'](mockCommunication as any);
569571

570572
expect(result).toMatchObject({
571573
id: '123',
@@ -595,7 +597,8 @@ describe('MedplumNotificationBackend', () => {
595597
],
596598
});
597599

598-
const result = backend.mapToDatabaseNotification(mockCommunication as any);
600+
// biome-ignore lint/complexity/useLiteralKeys: Testing private method directly for coverage - can ignore complexity here
601+
const result = backend['mapToDatabaseNotification'](mockCommunication as any);
599602

600603
expect(result).toMatchObject({
601604
id: '123',
@@ -608,7 +611,8 @@ describe('MedplumNotificationBackend', () => {
608611

609612
it('should handle notification with all required fields', () => {
610613
const mockCommunication = createMockCommunication({ id: '123' });
611-
const result = backend.mapToDatabaseNotification(mockCommunication as any);
614+
// biome-ignore lint/complexity/useLiteralKeys: Testing private method directly for coverage - can ignore complexity here
615+
const result = backend['mapToDatabaseNotification'](mockCommunication as any);
612616

613617
expect(result).toMatchObject({
614618
id: '123',
@@ -642,8 +646,10 @@ describe('MedplumNotificationBackend', () => {
642646
],
643647
});
644648

645-
const mappedWithSha = backend.mapToDatabaseNotification(withGitCommitSha as any);
646-
const mappedWithoutSha = backend.mapToDatabaseNotification(withoutGitCommitSha as any);
649+
// biome-ignore lint/complexity/useLiteralKeys: Testing private method directly for coverage - can ignore complexity here
650+
const mappedWithSha = backend['mapToDatabaseNotification'](withGitCommitSha as any);
651+
// biome-ignore lint/complexity/useLiteralKeys: Testing private method directly for coverage - can ignore complexity here
652+
const mappedWithoutSha = backend['mapToDatabaseNotification'](withoutGitCommitSha as any);
647653

648654
expect(mappedWithSha.gitCommitSha).toBe('d'.repeat(40));
649655
expect(mappedWithoutSha.gitCommitSha).toBeNull();

src/__tests__/medplum-logger.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
12
import { MedplumLogger } from '../medplum-logger';
23

34
describe('MedplumLogger', () => {
45
let logger: MedplumLogger;
5-
let consoleLogSpy: vi.SpyInstance;
6-
let consoleErrorSpy: vi.SpyInstance;
7-
let consoleWarnSpy: vi.SpyInstance;
6+
let consoleLogSpy: ReturnType<typeof vi.spyOn>;
7+
let consoleErrorSpy: ReturnType<typeof vi.spyOn>;
8+
let consoleWarnSpy: ReturnType<typeof vi.spyOn>;
89

910
beforeEach(() => {
1011
logger = new MedplumLogger();
11-
consoleLogSpy = vi.spyOn(console, 'log').mockImplementation();
12-
consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation();
13-
consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation();
12+
consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
13+
consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
14+
consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
1415
});
1516

1617
afterEach(() => {

src/__tests__/test.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { indexSearchParameterBundle, indexStructureDefinitionBundle } from '@medplum/core';
22
import { readJson, SEARCH_PARAMETER_BUNDLE_FILES } from '@medplum/definitions';
33
import type { Bundle, SearchParameter } from '@medplum/fhirtypes';
4+
import { beforeAll } from 'vitest';
45

56
beforeAll(() => {
67
indexStructureDefinitionBundle(readJson('fhir/r4/profiles-types.json') as Bundle);

0 commit comments

Comments
 (0)