@openmrs/esm-billing-app 1.0.2-pre.767 → 1.0.2-pre.768

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/.eslintrc CHANGED
@@ -2,13 +2,27 @@
2
2
  "env": {
3
3
  "node": true
4
4
  },
5
- "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
5
+ "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest-dom/recommended"],
6
+ "overrides": [
7
+ {
8
+ "files": ["**/*.test.tsx"],
9
+ "extends": ["plugin:testing-library/react"]
10
+ },
11
+ {
12
+ "files": ["e2e/**/*.ts"],
13
+ "extends": ["plugin:playwright/recommended"],
14
+ "rules": {
15
+ "testing-library/prefer-screen-queries": "off",
16
+ "react-hooks/rules-of-hooks": "off"
17
+ }
18
+ }
19
+ ],
6
20
  "parser": "@typescript-eslint/parser",
7
21
  "parserOptions": {
8
22
  "project": true,
9
23
  "tsconfigRootDir": "__dirname"
10
24
  },
11
- "plugins": ["@typescript-eslint", "import", "react-hooks"],
25
+ "plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
12
26
  "root": true,
13
27
  "rules": {
14
28
  // The following rules need `noImplicitAny` to be set to `true` in our tsconfig. They are too restrictive for now, but should be reconsidered in future
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"},"featureFlag":"billing"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"},"featureFlag":"billing"},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm","featureFlag":"billing"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billing-home-tiles-ext","slot":"billing-home-tiles-slot","component":"serviceMetrics"},{"name":"edit-bill-line-item-dialog","component":"editBillLineItemModal","online":true,"offline":true}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"add-payment-mode-modal","component":"addPaymentModeModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-billable-service-modal","component":"editBillableServiceModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"}],"featureFlags":[{"flagName":"billing","label":"Billing module","description":"This feature introduces navigation links on the patient chart and home page to allow accessing the billing module features"}],"version":"1.0.2-pre.767"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"},"featureFlag":"billing"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"},"featureFlag":"billing"},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm","featureFlag":"billing"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billing-home-tiles-ext","slot":"billing-home-tiles-slot","component":"serviceMetrics"},{"name":"edit-bill-line-item-dialog","component":"editBillLineItemModal","online":true,"offline":true}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"add-payment-mode-modal","component":"addPaymentModeModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-billable-service-modal","component":"editBillableServiceModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"}],"featureFlags":[{"flagName":"billing","label":"Billing module","description":"This feature introduces navigation links on the patient chart and home page to allow accessing the billing module features"}],"version":"1.0.2-pre.768"}
package/e2e/core/test.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { APIRequestContext, Page, test as base } from '@playwright/test';
1
+ import { type APIRequestContext, type Page, test as base } from '@playwright/test';
2
2
  import { api } from '../fixtures';
3
3
 
4
4
  // This file sets up our custom test harness using the custom fixtures.
@@ -1,5 +1,5 @@
1
1
  import { restBaseUrl } from '@openmrs/esm-framework';
2
- import { APIRequestContext, PlaywrightWorkerArgs, WorkerFixture } from '@playwright/test';
2
+ import { type APIRequestContext, type PlaywrightWorkerArgs, type WorkerFixture } from '@playwright/test';
3
3
 
4
4
  /**
5
5
  * A fixture which initializes an [`APIRequestContext`](https://playwright.dev/docs/api/class-apirequestcontext)
@@ -1,5 +1,5 @@
1
1
  # syntax=docker/dockerfile:1.3
2
- FROM --platform=$BUILDPLATFORM node:18-alpine as dev
2
+ FROM --platform=$BUILDPLATFORM node:22-alpine as dev
3
3
 
4
4
  ARG APP_SHELL_VERSION=next
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-billing-app",
3
- "version": "1.0.2-pre.767",
3
+ "version": "1.0.2-pre.768",
4
4
  "description": "O3 frontend module for handling billing concerns in healthcare settings",
5
5
  "browser": "dist/openmrs-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -86,7 +86,10 @@
86
86
  "dotenv": "^16.4.1",
87
87
  "eslint": "^8.56.0",
88
88
  "eslint-plugin-import": "^2.31.0",
89
+ "eslint-plugin-jest-dom": "^5.5.0",
90
+ "eslint-plugin-playwright": "^2.2.2",
89
91
  "eslint-plugin-react-hooks": "^5.0.0",
92
+ "eslint-plugin-testing-library": "^7.13.1",
90
93
  "husky": "^9.0.6",
91
94
  "i18next": "^23.7.20",
92
95
  "i18next-parser": "^8.12.0",
@@ -196,7 +196,7 @@ describe('BillsTable', () => {
196
196
  const patientNameLink = screen.getByRole('link', { name: 'John Doe' });
197
197
  expect(patientNameLink).toBeInTheDocument();
198
198
 
199
- expect(patientNameLink.getAttribute('href')).toEqual('/home/billing/patient/uuid1/1');
199
+ expect(patientNameLink).toHaveAttribute('href', '/home/billing/patient/uuid1/1');
200
200
  });
201
201
 
202
202
  test('should filter bills by payment status', async () => {
@@ -238,7 +238,7 @@ describe('Invoice', () => {
238
238
  render(<Invoice />);
239
239
 
240
240
  const printButton = screen.getByRole('button', { name: /print bill/i });
241
- expect(printButton).not.toBeDisabled();
241
+ expect(printButton).toBeEnabled();
242
242
  });
243
243
 
244
244
  it('should render patient header when patient data is available', () => {
@@ -34,13 +34,15 @@ describe('PaymentForm Component', () => {
34
34
  mutate: jest.fn(),
35
35
  });
36
36
 
37
- const { container } = render(
37
+ render(
38
38
  <Wrapper>
39
39
  <PaymentForm disablePayment={false} isSingleLineItem={false} />
40
40
  </Wrapper>,
41
41
  );
42
42
 
43
- expect(container.querySelector('.cds--skeleton')).toBeInTheDocument();
43
+ // When loading, payment method elements should not be present
44
+ expect(screen.queryByText(/select payment method/i)).not.toBeInTheDocument();
45
+ expect(screen.queryByPlaceholderText(/enter amount/i)).not.toBeInTheDocument();
44
46
  });
45
47
 
46
48
  test('should render error message when payment modes fail to load', () => {
@@ -226,7 +226,7 @@ describe('Payments', () => {
226
226
 
227
227
  it('should return null when bill is not provided', () => {
228
228
  const { container } = render(<Payments bill={null} mutate={mockMutate} />);
229
- expect(container.firstChild).toBeNull();
229
+ expect(container).toBeEmptyDOMElement();
230
230
  });
231
231
 
232
232
  it('should render add payment method button for bills with amount due', () => {
@@ -241,7 +241,7 @@ describe('Payments', () => {
241
241
 
242
242
  // Verify add payment method button is available
243
243
  expect(screen.getByText(/add payment method/i)).toBeInTheDocument();
244
- expect(screen.getByText(/add payment method/i)).not.toBeDisabled();
244
+ expect(screen.getByText(/add payment method/i)).toBeEnabled();
245
245
  });
246
246
 
247
247
  it('should display process payment button', () => {
@@ -23,7 +23,6 @@ describe('LinkExtension Component', () => {
23
23
  });
24
24
 
25
25
  describe('createLeftPanelLink Function', () => {
26
- const user = userEvent.setup();
27
26
  test('returns a component that renders LinkExtension', () => {
28
27
  const config = { name: 'billing', title: 'Billing' };
29
28
  const TestComponent = createLeftPanelLink(config);
@@ -31,8 +30,6 @@ describe('createLeftPanelLink Function', () => {
31
30
  render(<TestComponent />);
32
31
  expect(screen.getByText('Billing')).toBeInTheDocument();
33
32
  const testLink = screen.getByRole('link', { name: 'Billing' });
34
- user.click(testLink);
35
- expect(window.location.pathname).toBe('/billing/6eb8d678-514d-46ad-9554-51e48d96d567');
36
- // expect(testLink).toHaveClass('active-left-nav-link');
33
+ expect(testLink).toHaveAttribute('href', '/openmrs/spa/home/billing');
37
34
  });
38
35
  });