@openmrs/esm-openconceptlab-app 4.0.3 → 4.0.4-pre.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +26 -23
- package/dist/367.js +2 -0
- package/dist/{831.js.LICENSE.txt → 367.js.LICENSE.txt} +2 -0
- package/dist/367.js.map +1 -0
- package/dist/542.js +2 -0
- package/dist/542.js.map +1 -0
- package/dist/586.js +1 -0
- package/dist/586.js.map +1 -0
- package/dist/589.js +1 -0
- package/dist/{173.js.map → 589.js.map} +1 -1
- package/dist/607.js +2 -0
- package/dist/607.js.map +1 -0
- package/dist/89.js +1 -0
- package/dist/89.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-openconceptlab-app.js +1 -1
- package/dist/openmrs-esm-openconceptlab-app.js.buildmanifest.json +90 -90
- package/dist/openmrs-esm-openconceptlab-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -2
- package/src/{declarations.d.tsx → declarations.d.ts} +0 -1
- package/src/import/import.test.tsx +16 -37
- package/src/previous-imports/import-overview/import-items.test.tsx +6 -24
- package/src/previous-imports/import-overview/import-overview.test.tsx +4 -8
- package/src/previous-imports/previous-imports.test.tsx +5 -31
- package/src/root.test.tsx +3 -8
- package/src/subscription/subscription.test.tsx +20 -43
- package/tsconfig.json +1 -1
- package/dist/173.js +0 -1
- package/dist/225.js +0 -2
- package/dist/225.js.map +0 -1
- package/dist/553.js +0 -2
- package/dist/553.js.map +0 -1
- package/dist/745.js +0 -1
- package/dist/745.js.map +0 -1
- package/dist/831.js +0 -2
- package/dist/831.js.map +0 -1
- package/dist/878.js +0 -1
- package/dist/878.js.map +0 -1
- /package/dist/{553.js.LICENSE.txt → 542.js.LICENSE.txt} +0 -0
- /package/dist/{225.js.LICENSE.txt → 607.js.LICENSE.txt} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import
|
|
5
|
-
import { openmrsFetch, showNotification } from '@openmrs/esm-framework';
|
|
3
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { type FetchResponse, openmrsFetch, showNotification } from '@openmrs/esm-framework';
|
|
5
|
+
import { mockSubscription } from '../../../../__mocks__/openconceptlab.mock';
|
|
6
6
|
import { renderWithSwr } from '../../../../tools/test-helpers';
|
|
7
7
|
import { startImportWithSubscription } from './import.resource';
|
|
8
|
-
import
|
|
8
|
+
import Import from './import.component';
|
|
9
9
|
|
|
10
10
|
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const mockShowNotification = jest.mocked(showNotification);
|
|
12
|
+
const mockStartImportWithSubscription = jest.mocked(startImportWithSubscription);
|
|
13
13
|
|
|
14
14
|
jest.mock('./import.resource', () => {
|
|
15
15
|
const originalModule = jest.requireActual('./import.resource');
|
|
@@ -21,27 +21,10 @@ jest.mock('./import.resource', () => {
|
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
...originalModule,
|
|
29
|
-
showNotification: jest.fn(),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe(`Import component`, () => {
|
|
34
|
-
afterEach(() => {
|
|
35
|
-
mockShowNotification.mockReset();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it(`renders without dying`, () => {
|
|
39
|
-
renderImportComponent();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it(`renders the form elements`, async () => {
|
|
24
|
+
describe('Import component', () => {
|
|
25
|
+
it('renders the form elements', async () => {
|
|
43
26
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
44
|
-
|
|
27
|
+
renderWithSwr(<Import />);
|
|
45
28
|
await waitForLoadingToFinish();
|
|
46
29
|
|
|
47
30
|
expect(screen.getByText('Import Concepts')).toBeVisible();
|
|
@@ -52,30 +35,30 @@ describe(`Import component`, () => {
|
|
|
52
35
|
expect(screen.queryByText('File Added')).not.toBeInTheDocument();
|
|
53
36
|
});
|
|
54
37
|
|
|
55
|
-
it(
|
|
38
|
+
it('renders correctly when there is no subscription', async () => {
|
|
56
39
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
57
|
-
|
|
40
|
+
renderWithSwr(<Import />);
|
|
58
41
|
await waitForLoadingToFinish();
|
|
59
42
|
|
|
60
43
|
expect(screen.getByText('Import from Subscription')).toBeDisabled();
|
|
61
44
|
expect(screen.getByText('Import from file')).toBeEnabled();
|
|
62
45
|
});
|
|
63
46
|
|
|
64
|
-
it(
|
|
47
|
+
it('renders correctly when when a subscription exists', async () => {
|
|
65
48
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [mockSubscription] } });
|
|
66
|
-
|
|
49
|
+
renderWithSwr(<Import />);
|
|
67
50
|
await waitForLoadingToFinish();
|
|
68
51
|
|
|
69
52
|
await waitFor(() => expect(screen.getByText('Import from Subscription')).toBeEnabled(), { timeout: 2000 });
|
|
70
53
|
expect(screen.getByText('Import from file')).toBeEnabled();
|
|
71
54
|
});
|
|
72
55
|
|
|
73
|
-
it(
|
|
56
|
+
it('allows starting an import using the subscription', async () => {
|
|
74
57
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [mockSubscription] } });
|
|
75
|
-
|
|
58
|
+
renderWithSwr(<Import />);
|
|
76
59
|
await waitForLoadingToFinish();
|
|
77
60
|
|
|
78
|
-
mockStartImportWithSubscription.
|
|
61
|
+
mockStartImportWithSubscription.mockResolvedValue({ status: 201 } as unknown as FetchResponse);
|
|
79
62
|
|
|
80
63
|
await waitFor(() => userEvent.click(screen.getByText('Import from Subscription')));
|
|
81
64
|
|
|
@@ -92,10 +75,6 @@ describe(`Import component`, () => {
|
|
|
92
75
|
});
|
|
93
76
|
});
|
|
94
77
|
|
|
95
|
-
function renderImportComponent() {
|
|
96
|
-
renderWithSwr(<Import />);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
78
|
function waitForLoadingToFinish() {
|
|
100
79
|
return waitFor(() => {
|
|
101
80
|
expect(screen.getByText('Import Concepts')).toBeVisible, { timeout: 2000 };
|
|
@@ -6,7 +6,7 @@ import { mockImportItems, mockPreviousImports } from '../../../../../__mocks__/o
|
|
|
6
6
|
import { getImportDetails } from './import-items.resource';
|
|
7
7
|
import ImportItems from './import-items.component';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const defaultProps = {
|
|
10
10
|
importUuid: mockPreviousImports[1].uuid,
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -22,43 +22,29 @@ jest.mock('./import-items.resource', () => {
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
...originalModule,
|
|
30
|
-
usePagination: jest.fn(),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe(`Import Items component`, () => {
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
mockGetImportDetails.mockReset();
|
|
37
|
-
mockUsePagination.mockReset();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it(`renders the table`, async () => {
|
|
25
|
+
describe('Import items', () => {
|
|
26
|
+
it('renders a tabular overview', async () => {
|
|
41
27
|
mockGetImportDetails.mockReturnValue({ status: 200, ok: true, data: mockImportItems });
|
|
42
28
|
mockUsePagination.mockReturnValue({
|
|
43
29
|
currentPage: 1,
|
|
44
30
|
goTo: () => {},
|
|
45
31
|
results: mockImportItems,
|
|
46
32
|
});
|
|
47
|
-
|
|
33
|
+
renderWithSwr(<ImportItems {...defaultProps} />);
|
|
48
34
|
await waitForLoadingToFinish();
|
|
49
35
|
|
|
50
36
|
expect(screen.getByText('Concept/Mapping')).toBeVisible();
|
|
51
37
|
expect(screen.getByText('Message')).toBeVisible();
|
|
52
38
|
});
|
|
53
39
|
|
|
54
|
-
it(
|
|
40
|
+
it('renders the import items correctly', async () => {
|
|
55
41
|
mockGetImportDetails.mockReturnValue({ status: 200, ok: true, data: mockImportItems });
|
|
56
42
|
mockUsePagination.mockReturnValue({
|
|
57
43
|
currentPage: 1,
|
|
58
44
|
goTo: () => {},
|
|
59
45
|
results: mockImportItems,
|
|
60
46
|
});
|
|
61
|
-
|
|
47
|
+
renderWithSwr(<ImportItems {...defaultProps} />);
|
|
62
48
|
await waitForLoadingToFinish();
|
|
63
49
|
|
|
64
50
|
expect(screen.getByText('Concept/Mapping')).toBeVisible();
|
|
@@ -71,10 +57,6 @@ describe(`Import Items component`, () => {
|
|
|
71
57
|
});
|
|
72
58
|
});
|
|
73
59
|
|
|
74
|
-
function renderImportItemsComponent() {
|
|
75
|
-
renderWithSwr(<ImportItems {...testProps} />);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
60
|
function waitForLoadingToFinish() {
|
|
79
61
|
return waitFor(() => {
|
|
80
62
|
expect(screen.getByText('Concept/Mapping')).toBeVisible(), { timeout: 2000 };
|
|
@@ -5,12 +5,8 @@ import { renderWithSwr } from '../../../../../tools/test-helpers';
|
|
|
5
5
|
import { mockPreviousImports } from '../../../../../__mocks__/openconceptlab.mock';
|
|
6
6
|
import ImportOverview from './import-overview.component';
|
|
7
7
|
|
|
8
|
-
describe(
|
|
9
|
-
it(
|
|
10
|
-
renderImportOverviewComponent(mockPreviousImports[0]);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it(`renders the fields`, async () => {
|
|
8
|
+
describe('Import Overview component', () => {
|
|
9
|
+
it('renders the fields', async () => {
|
|
14
10
|
renderImportOverviewComponent(mockPreviousImports[0]);
|
|
15
11
|
await waitForLoadingToFinish();
|
|
16
12
|
|
|
@@ -20,7 +16,7 @@ describe(`Import Overview component`, () => {
|
|
|
20
16
|
expect(screen.getByText('Result:')).toBeVisible();
|
|
21
17
|
});
|
|
22
18
|
|
|
23
|
-
it(
|
|
19
|
+
it('renders the import details when no errored items', async () => {
|
|
24
20
|
const selectedImport = mockPreviousImports[0];
|
|
25
21
|
|
|
26
22
|
renderImportOverviewComponent(selectedImport);
|
|
@@ -45,7 +41,7 @@ describe(`Import Overview component`, () => {
|
|
|
45
41
|
expect(screen.getByText(ignoredErrorsText)).toBeVisible();
|
|
46
42
|
});
|
|
47
43
|
|
|
48
|
-
it(
|
|
44
|
+
it('renders the import details when there are errored items', async () => {
|
|
49
45
|
const selectedImport = mockPreviousImports[1];
|
|
50
46
|
|
|
51
47
|
renderImportOverviewComponent(selectedImport);
|
|
@@ -8,37 +8,15 @@ import PreviousImports from './previous-imports.component';
|
|
|
8
8
|
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
9
9
|
const mockUsePagination = usePagination as jest.Mock;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
...originalModule,
|
|
16
|
-
usePagination: jest.fn(),
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe(`Previous Imports component`, () => {
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
mockUsePagination.mockReset();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it(`renders without dying`, () => {
|
|
26
|
-
mockUsePagination.mockReturnValue({
|
|
27
|
-
currentPage: 1,
|
|
28
|
-
goTo: () => {},
|
|
29
|
-
results: [],
|
|
30
|
-
});
|
|
31
|
-
renderPreviousImportsComponent();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it(`renders the table`, async () => {
|
|
11
|
+
describe('Previous imports', () => {
|
|
12
|
+
it('renders the table', async () => {
|
|
35
13
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
36
14
|
mockUsePagination.mockReturnValue({
|
|
37
15
|
currentPage: 1,
|
|
38
16
|
goTo: () => {},
|
|
39
17
|
results: [],
|
|
40
18
|
});
|
|
41
|
-
|
|
19
|
+
renderWithSwr(<PreviousImports />);
|
|
42
20
|
await waitForLoadingToFinish();
|
|
43
21
|
|
|
44
22
|
expect(screen.getByText('Previous Imports')).toBeVisible();
|
|
@@ -47,14 +25,14 @@ describe(`Previous Imports component`, () => {
|
|
|
47
25
|
expect(screen.getByText('Status')).toBeVisible();
|
|
48
26
|
});
|
|
49
27
|
|
|
50
|
-
it(
|
|
28
|
+
it('renders the previous imports correctly', async () => {
|
|
51
29
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: mockPreviousImports } });
|
|
52
30
|
mockUsePagination.mockReturnValue({
|
|
53
31
|
currentPage: 1,
|
|
54
32
|
goTo: () => {},
|
|
55
33
|
results: mockPreviousImports,
|
|
56
34
|
});
|
|
57
|
-
|
|
35
|
+
renderWithSwr(<PreviousImports />);
|
|
58
36
|
await waitForLoadingToFinish();
|
|
59
37
|
|
|
60
38
|
mockPreviousImports.forEach((item) => {
|
|
@@ -65,10 +43,6 @@ describe(`Previous Imports component`, () => {
|
|
|
65
43
|
});
|
|
66
44
|
});
|
|
67
45
|
|
|
68
|
-
function renderPreviousImportsComponent() {
|
|
69
|
-
renderWithSwr(<PreviousImports />);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
46
|
function waitForLoadingToFinish() {
|
|
73
47
|
return waitFor(() => {
|
|
74
48
|
expect(screen.getByText('Previous Imports')).toBeVisible(), { timeout: 2000 };
|
package/src/root.test.tsx
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render,
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import Root from './root.component';
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
|
|
7
|
-
it(`renders without dying`, () => {
|
|
8
|
-
renderOclSubscriptionModule();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it(`renders the title and tab containers`, () => {
|
|
5
|
+
describe('Root component', () => {
|
|
6
|
+
it('renders the title and tab containers', () => {
|
|
12
7
|
renderOclSubscriptionModule();
|
|
13
8
|
expect(screen.getByText('OCL Subscription Module')).toBeInTheDocument();
|
|
14
9
|
expect(screen.getByRole('tab', { name: 'Subscription' })).toBeInTheDocument();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { screen, waitFor } from '@testing-library/react';
|
|
3
2
|
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import
|
|
5
|
-
import { openmrsFetch, showNotification } from '@openmrs/esm-framework';
|
|
3
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { type FetchResponse, openmrsFetch, showNotification } from '@openmrs/esm-framework';
|
|
6
5
|
import { renderWithSwr } from '../../../../tools/test-helpers';
|
|
7
6
|
import { deleteSubscription, updateSubscription } from './subscription.resource';
|
|
8
7
|
import { mockSubscription } from '../../../../__mocks__/openconceptlab.mock';
|
|
8
|
+
import Subscription from './subscription.component';
|
|
9
9
|
|
|
10
10
|
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
11
|
-
const mockUpdateSubscription =
|
|
12
|
-
const mockDeleteSubscription =
|
|
13
|
-
const mockShowNotification =
|
|
11
|
+
const mockUpdateSubscription = jest.mocked(updateSubscription);
|
|
12
|
+
const mockDeleteSubscription = jest.mocked(deleteSubscription);
|
|
13
|
+
const mockShowNotification = jest.mocked(showNotification);
|
|
14
14
|
|
|
15
15
|
jest.mock('./subscription.resource', () => {
|
|
16
16
|
const originalModule = jest.requireActual('./subscription.resource');
|
|
@@ -22,29 +22,10 @@ jest.mock('./subscription.resource', () => {
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
...originalModule,
|
|
30
|
-
showNotification: jest.fn(),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe(`Subscription component`, () => {
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
mockShowNotification.mockReset();
|
|
37
|
-
mockUpdateSubscription.mockReset();
|
|
38
|
-
mockOpenmrsFetch.mockReset();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it(`renders without dying`, () => {
|
|
42
|
-
renderSubscriptionComponent();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it(`renders the empty forms`, async () => {
|
|
25
|
+
describe('Subscription component', () => {
|
|
26
|
+
it('renders the empty forms', async () => {
|
|
46
27
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
47
|
-
|
|
28
|
+
renderWithSwr(<Subscription />);
|
|
48
29
|
await waitForLoadingToFinish();
|
|
49
30
|
|
|
50
31
|
expect(screen.getByText('Setup Subscription')).toBeVisible();
|
|
@@ -52,9 +33,9 @@ describe(`Subscription component`, () => {
|
|
|
52
33
|
expect(screen.getByRole('button', { name: 'danger Unsubscribe' })).toBeDisabled();
|
|
53
34
|
});
|
|
54
35
|
|
|
55
|
-
it(
|
|
36
|
+
it('renders the subscription if a subscription exists', async () => {
|
|
56
37
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [mockSubscription] } });
|
|
57
|
-
|
|
38
|
+
renderWithSwr(<Subscription />);
|
|
58
39
|
await waitForLoadingToFinish();
|
|
59
40
|
await waitForLoadingSubscription();
|
|
60
41
|
|
|
@@ -67,16 +48,16 @@ describe(`Subscription component`, () => {
|
|
|
67
48
|
expect(screen.getByRole('button', { name: 'danger Unsubscribe' })).toBeEnabled();
|
|
68
49
|
});
|
|
69
50
|
|
|
70
|
-
xit(
|
|
51
|
+
xit('allows adding a new subscription', async () => {
|
|
71
52
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
72
|
-
|
|
53
|
+
renderWithSwr(<Subscription />);
|
|
73
54
|
await waitForLoadingToFinish();
|
|
74
55
|
|
|
75
56
|
const urlInputField = screen.getByLabelText('Subscription URL');
|
|
76
57
|
const tokenInputField = screen.getByLabelText('Token');
|
|
77
58
|
const saveButton = screen.getByRole('button', { name: 'Save changes' });
|
|
78
59
|
|
|
79
|
-
mockUpdateSubscription.
|
|
60
|
+
mockUpdateSubscription.mockResolvedValueOnce({ status: 201, ok: true } as unknown as FetchResponse);
|
|
80
61
|
|
|
81
62
|
await waitFor(() => userEvent.type(urlInputField, mockSubscription.url));
|
|
82
63
|
await waitFor(() => userEvent.type(tokenInputField, mockSubscription.token));
|
|
@@ -97,9 +78,9 @@ describe(`Subscription component`, () => {
|
|
|
97
78
|
expect(mockShowNotification).toHaveBeenCalledTimes(1);
|
|
98
79
|
});
|
|
99
80
|
|
|
100
|
-
xit(
|
|
81
|
+
xit('allows changing the saved subscription', async () => {
|
|
101
82
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [mockSubscription] } });
|
|
102
|
-
|
|
83
|
+
renderWithSwr(<Subscription />);
|
|
103
84
|
await waitForLoadingToFinish();
|
|
104
85
|
await waitForLoadingSubscription();
|
|
105
86
|
|
|
@@ -107,7 +88,7 @@ describe(`Subscription component`, () => {
|
|
|
107
88
|
const tokenInputField = screen.getByLabelText('Token');
|
|
108
89
|
const saveButton = screen.getByRole('button', { name: 'Save changes' });
|
|
109
90
|
|
|
110
|
-
mockUpdateSubscription.
|
|
91
|
+
mockUpdateSubscription.mockResolvedValueOnce({ status: 200, ok: true } as unknown as FetchResponse);
|
|
111
92
|
|
|
112
93
|
await waitFor(() => userEvent.clear(urlInputField));
|
|
113
94
|
await waitFor(() => userEvent.clear(tokenInputField));
|
|
@@ -136,15 +117,15 @@ describe(`Subscription component`, () => {
|
|
|
136
117
|
expect(mockShowNotification).toHaveBeenCalledTimes(1);
|
|
137
118
|
});
|
|
138
119
|
|
|
139
|
-
xit(
|
|
120
|
+
xit('allows removing the saved subscription', async () => {
|
|
140
121
|
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [mockSubscription] } });
|
|
141
|
-
|
|
122
|
+
renderWithSwr(<Subscription />);
|
|
142
123
|
await waitForLoadingToFinish();
|
|
143
124
|
await waitForLoadingSubscription();
|
|
144
125
|
|
|
145
126
|
const unsubscribeButton = screen.getByRole('button', { name: 'danger Unsubscribe' });
|
|
146
127
|
|
|
147
|
-
mockDeleteSubscription.
|
|
128
|
+
mockDeleteSubscription.mockResolvedValueOnce({ status: 204 } as unknown as FetchResponse);
|
|
148
129
|
|
|
149
130
|
await waitFor(() => userEvent.click(unsubscribeButton));
|
|
150
131
|
|
|
@@ -164,10 +145,6 @@ describe(`Subscription component`, () => {
|
|
|
164
145
|
});
|
|
165
146
|
});
|
|
166
147
|
|
|
167
|
-
function renderSubscriptionComponent() {
|
|
168
|
-
renderWithSwr(<Subscription />);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
148
|
function waitForLoadingToFinish() {
|
|
172
149
|
return waitFor(() => {
|
|
173
150
|
expect(screen.getByText('Setup Subscription')).toBeVisible(), { timeout: 2000 };
|
package/tsconfig.json
CHANGED
package/dist/173.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_openconceptlab_app=globalThis.webpackChunk_openmrs_esm_openconceptlab_app||[]).push([[173],{6173:(e,n,o)=>{"use strict";o.r(n),o.d(n,{adminOclCardLink:()=>l,importTranslation:()=>c,root:()=>i,startupApp:()=>p});var r=o(1083),t={},a="@openmrs/esm-openconceptlab-app",s={featureName:"openconceptlab",moduleName:a},c=o(4767);function p(){(0,r.defineConfigSchema)(a,t)}var i=(0,r.getAsyncLifecycle)((function(){return Promise.all([o.e(225),o.e(553),o.e(343),o.e(46),o.e(878)]).then(o.bind(o,3985))}),s),l=(0,r.getAsyncLifecycle)((function(){return Promise.all([o.e(225),o.e(343),o.e(46),o.e(745)]).then(o.bind(o,3745))}),s)},4767:(e,n,o)=>{var r={"./ar.json":[4132,132],"./en.json":[4300,300],"./es.json":[3099,99],"./fr.json":[4055,55]};function t(e){if(!o.o(r,e))return Promise.resolve().then((()=>{var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=r[e],t=n[0];return o.e(n[1]).then((()=>o(t)))}t.keys=()=>Object.keys(r),t.id=4767,e.exports=t}}]);
|