@openmrs/esm-stock-management-app 3.0.1-pre.853 → 3.0.1-pre.855

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.
Files changed (108) hide show
  1. package/.husky/pre-commit +1 -4
  2. package/__mocks__/react-i18next.js +9 -8
  3. package/dist/10.js +1 -1
  4. package/dist/10.js.map +1 -1
  5. package/dist/119.js +1 -1
  6. package/dist/119.js.map +1 -1
  7. package/dist/14.js +1 -1
  8. package/dist/14.js.map +1 -1
  9. package/dist/172.js +1 -1
  10. package/dist/172.js.map +1 -1
  11. package/dist/20.js +1 -1
  12. package/dist/20.js.map +1 -1
  13. package/dist/290.js +1 -1
  14. package/dist/290.js.map +1 -1
  15. package/dist/467.js +1 -1
  16. package/dist/467.js.map +1 -1
  17. package/dist/574.js +1 -1
  18. package/dist/606.js +1 -1
  19. package/dist/606.js.map +1 -1
  20. package/dist/627.js +1 -0
  21. package/dist/627.js.map +1 -0
  22. package/dist/642.js +1 -1
  23. package/dist/642.js.map +1 -1
  24. package/dist/675.js +1 -1
  25. package/dist/675.js.map +1 -1
  26. package/dist/727.js +1 -1
  27. package/dist/727.js.map +1 -1
  28. package/dist/842.js +1 -1
  29. package/dist/842.js.map +1 -1
  30. package/dist/93.js +1 -1
  31. package/dist/93.js.map +1 -1
  32. package/dist/main.js +1 -1
  33. package/dist/main.js.map +1 -1
  34. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +70 -70
  35. package/dist/routes.json +1 -1
  36. package/jest.config.js +3 -6
  37. package/package.json +1 -1
  38. package/src/core/components/table/table.component.tsx +2 -2
  39. package/src/index.ts +5 -5
  40. package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +3 -3
  41. package/src/stock-items/add-bulk-stock-item/{stock-items-bulk-import.modal.tsx → stock-items-bulk-import.component.tsx} +19 -20
  42. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +1 -1
  43. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.test.tsx +59 -59
  44. package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +6 -6
  45. package/src/stock-items/add-stock-item/add-stock-item.component.tsx +4 -6
  46. package/src/stock-items/add-stock-item/add-stock-item.scss +0 -5
  47. package/src/stock-items/add-stock-item/add-stock-item.test.tsx +43 -28
  48. package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +4 -3
  49. package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +10 -9
  50. package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +4 -4
  51. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +19 -27
  52. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +4 -4
  53. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +9 -15
  54. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +0 -1
  55. package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +1 -2
  56. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +16 -14
  57. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +3 -7
  58. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-bincard-preview.modal.tsx +6 -14
  59. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-stockcard-preview.modal.tsx +8 -14
  60. package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +2 -2
  61. package/src/stock-items/stock-item.utils.tsx +5 -3
  62. package/src/stock-items/stock-items-table.component.tsx +45 -47
  63. package/src/stock-items/stock-items-table.resource.ts +2 -2
  64. package/src/stock-items/stock-items-table.scss +1 -5
  65. package/src/stock-items/stock-items-table.test.tsx +65 -106
  66. package/src/stock-locations/location-admin-form.component.tsx +4 -5
  67. package/src/stock-locations/stock-locations-table.component.tsx +8 -10
  68. package/src/stock-lookups/stock-lookups.resource.ts +2 -3
  69. package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +2 -2
  70. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.component.tsx +11 -11
  71. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.test.tsx +25 -115
  72. package/src/stock-operations/stock-operations-forms/input-components/qty-uim-selector.test.tsx +65 -107
  73. package/src/stock-operations/stock-operations-forms/input-components/quantity-uom-selector.component.tsx +9 -9
  74. package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.test.tsx +153 -35
  75. package/src/stock-operations/stock-operations-forms/input-components/user-selector.test.tsx +29 -82
  76. package/src/stock-operations/stock-operations-forms/step1.test.tsx +69 -204
  77. package/src/stock-operations/stock-operations-forms/step2.test.tsx +63 -140
  78. package/src/stock-operations/stock-operations-forms/step3.test.tsx +60 -79
  79. package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.component.tsx +5 -6
  80. package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +11 -12
  81. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.scss +0 -1
  82. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +12 -20
  83. package/src/stock-operations/stock-operations-forms/stock-operation-form.scss +0 -1
  84. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stepper.scss +3 -1
  85. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stock-operation-stepper.component.tsx +1 -2
  86. package/src/stock-reports/generate-report/create-stock-report.scss +2 -3
  87. package/src/stock-reports/generate-report/create-stock-report.workspace.tsx +25 -32
  88. package/src/stock-reports/report-list/stock-report-parameters.component.tsx +1 -1
  89. package/src/stock-reports/report-list/stock-report-status.component.tsx +1 -1
  90. package/src/stock-reports/report-list/stock-reports.component.tsx +25 -24
  91. package/src/stock-reports/report-list/stock-reports.scss +2 -10
  92. package/src/stock-sources/add-stock-sources/add-stock-sources.scss +4 -11
  93. package/src/stock-sources/add-stock-sources/add-stock-sources.test.tsx +36 -38
  94. package/src/stock-sources/add-stock-sources/add-stock-sources.workspace.tsx +30 -35
  95. package/src/stock-sources/delete-stock-modal.component.tsx +1 -2
  96. package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +36 -27
  97. package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +21 -33
  98. package/src/stock-sources/stock-sources-items-table.component.tsx +17 -16
  99. package/src/stock-sources/stock-sources-items-table.resource.ts +6 -8
  100. package/src/stock-sources/stock-sources-items-table.test.tsx +37 -60
  101. package/src/stock-sources/stock-sources.scss +2 -6
  102. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +13 -5
  103. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx +2 -2
  104. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +1 -2
  105. package/translations/en.json +6 -5
  106. package/tsconfig.json +0 -4
  107. package/dist/33.js +0 -1
  108. package/dist/33.js.map +0 -1
@@ -1,6 +1,12 @@
1
- import React from 'react';
1
+ import { useConfig } from '@openmrs/esm-framework';
2
2
  import { render, screen } from '@testing-library/react';
3
- import { useConfig, useSession } from '@openmrs/esm-framework';
3
+ import React from 'react';
4
+ import { StockOperationType } from '../../core/api/types/stockOperation/StockOperationType';
5
+ import { useStockOperationTypes } from '../../stock-lookups/stock-lookups.resource';
6
+ import { useStockOperations } from '../stock-operations.resource';
7
+ import useParties from './hooks/useParties';
8
+ import StockOperationForm from './stock-operation-form.component';
9
+ import { MAIN_STORE_LOCATION_TAG } from '../../constants';
4
10
  import {
5
11
  adjustmentOpeationTypeMock,
6
12
  disposalOperationTypeMock,
@@ -11,17 +17,28 @@ import {
11
17
  stockIssueOperationtypeMock,
12
18
  stockTakeOperationTypeMock,
13
19
  tranferOutOperationTypeMock,
14
- } from '@mocks';
15
- import { useStockOperationTypes } from '../../stock-lookups/stock-lookups.resource';
16
- import { useStockOperations } from '../stock-operations.resource';
17
- import useParties from './hooks/useParties';
18
- import StockOperationForm from './stock-operation-form.component';
20
+ } from '../../../__mocks__';
21
+ jest.mock('react-i18next', () => ({
22
+ useTranslation: jest.fn().mockReturnValue({ t: (key) => key }),
23
+ }));
19
24
 
20
- const mockUseParties = jest.mocked(useParties);
21
- const mockUseStockOperationTypes = jest.mocked(useStockOperationTypes);
22
- const mockUseStockOperations = jest.mocked(useStockOperations);
23
- const mockUseConfig = jest.mocked(useConfig);
24
- const mockUseSession = jest.mocked(useSession);
25
+ jest.mock('@openmrs/esm-framework', () => ({
26
+ ActionMenu: jest.fn(() => null),
27
+ showSnackbar: jest.fn(),
28
+ useDebounce: jest.fn((x) => x),
29
+ getGlobalStore: jest.fn(() => ({
30
+ getState: jest.fn(),
31
+ subscribe: jest.fn(),
32
+ setState: jest.fn(),
33
+ })),
34
+ parseDate: jest.fn((date) => new Date(date)),
35
+ showNotification: jest.fn(),
36
+ usePagination: jest.fn(() => ({ currentPage: 1, setPage: jest.fn() })),
37
+ useSession: jest.fn(() => ({ user: { display: 'Test User' } })),
38
+ useConfig: jest.fn(),
39
+ ErrorState: jest.fn(({ error }: { error: any }) => <div>{error}</div>),
40
+ launchWorkspace: jest.fn(),
41
+ }));
25
42
 
26
43
  jest.mock('../../stock-lookups/stock-lookups.resource', () => ({
27
44
  useStockOperationTypes: jest.fn(),
@@ -31,14 +48,10 @@ jest.mock('../../stock-lookups/stock-lookups.resource', () => ({
31
48
  }));
32
49
 
33
50
  jest.mock('../stock-operations.resource', () => ({
34
- getStockOperationLinks: jest.fn(),
35
51
  operationStatusColor: jest.fn(() => 'some-color'),
52
+ getStockOperationLinks: jest.fn(),
36
53
  useStockOperations: jest.fn().mockReturnValue({
37
- items: {
38
- results: [],
39
- links: [],
40
- totalCount: 0,
41
- },
54
+ items: { results: [] },
42
55
  isLoading: false,
43
56
  error: null,
44
57
  }),
@@ -54,75 +67,25 @@ jest.mock('../stock-operations.resource', () => ({
54
67
  }),
55
68
  }));
56
69
 
57
- jest.mock('./hooks/useParties', () => ({
58
- __esModule: true,
59
- default: jest.fn(),
60
- useParties: jest.fn(),
61
- }));
70
+ jest.mock('./hooks/useParties', () => jest.fn());
62
71
 
63
72
  describe('Stock Operation step 1 (baseoperation details)', () => {
64
73
  beforeEach(() => {
65
- const mockStockOperationTypes = {
66
- results: [],
67
- links: [],
68
- totalCount: 0,
69
- };
70
- mockUseStockOperationTypes.mockReturnValue({
71
- types: mockStockOperationTypes,
72
- isLoading: false,
73
- error: null,
74
- });
75
- mockUseStockOperations.mockReturnValue({
76
- items: {
77
- results: [],
78
- links: [],
79
- totalCount: 0,
80
- },
81
- isLoading: false,
82
- error: null,
83
- });
84
-
85
- mockUseConfig.mockReturnValue({ autoPopulateResponsiblePerson: true });
86
-
87
- mockUseSession.mockReturnValue({
88
- authenticated: true,
89
- sessionId: 'test-session-id',
90
- user: {
91
- uuid: 'test-user-uuid',
92
- display: 'Test User',
93
- username: 'testuser',
94
- systemId: 'test-system-id',
95
- userProperties: {},
96
- person: { uuid: 'test-person-uuid' },
97
- privileges: [],
98
- roles: [],
99
- retired: false,
100
- links: [],
101
- locale: 'en',
102
- allowedLocales: ['en'],
103
- },
104
- sessionLocation: {
105
- uuid: 'test-location-uuid',
106
- display: 'Test Location',
107
- links: [],
108
- },
109
- });
74
+ const mockStockOperationTypes = { results: [] };
75
+ (useStockOperationTypes as jest.Mock).mockReturnValue(mockStockOperationTypes);
76
+ (useStockOperations as jest.Mock).mockReturnValue({ items: { results: [] }, isLoading: false, error: null });
77
+ (useConfig as jest.Mock).mockReturnValue({ autoPopulateResponsiblePerson: true });
110
78
  });
111
79
 
112
80
  it('should render loading state when loading parties info', async () => {
113
- mockUseParties.mockReturnValue({
81
+ (useParties as jest.Mock).mockReturnValue({
114
82
  destinationParties: [],
115
- destinationPartiesFilter: () => true,
116
- destinationTags: [],
117
- error: null,
118
- isLoading: true,
119
- mutate: jest.fn(),
120
- parties: [],
121
83
  sourceParties: [],
122
- sourcePartiesFilter: () => true,
84
+ isLoading: true,
85
+ error: null,
123
86
  sourceTags: [],
87
+ destinationTags: [],
124
88
  });
125
-
126
89
  render(
127
90
  <StockOperationForm
128
91
  stockOperationType={receiptOperationTypeMock as any}
@@ -132,24 +95,18 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
132
95
  promptBeforeClosing={jest.fn()}
133
96
  />,
134
97
  );
135
-
136
98
  expect(screen.getByRole('progressbar')).toBeInTheDocument();
137
99
  });
138
100
 
139
101
  it('should render error state when parties loading fails', async () => {
140
- mockUseParties.mockReturnValue({
102
+ (useParties as jest.Mock).mockReturnValue({
141
103
  destinationParties: [],
142
- destinationPartiesFilter: () => true,
143
- destinationTags: [],
144
- error: 'error',
145
- isLoading: false,
146
- mutate: jest.fn(),
147
- parties: [],
148
104
  sourceParties: [],
149
- sourcePartiesFilter: () => true,
105
+ isLoading: false,
106
+ error: 'error',
150
107
  sourceTags: [],
108
+ destinationTags: [],
151
109
  });
152
-
153
110
  render(
154
111
  <StockOperationForm
155
112
  stockOperationType={receiptOperationTypeMock as any}
@@ -159,24 +116,18 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
159
116
  promptBeforeClosing={jest.fn()}
160
117
  />,
161
118
  );
162
-
163
- expect(screen.getByText(/error state/i)).toBeInTheDocument();
119
+ expect(screen.getByText('error')).toBeInTheDocument();
164
120
  });
165
121
 
166
122
  it('should have only next btn and not previous btn', async () => {
167
- mockUseParties.mockReturnValue({
123
+ (useParties as jest.Mock).mockReturnValue({
168
124
  destinationParties: [],
169
- destinationPartiesFilter: () => true,
170
- destinationTags: [],
171
- error: undefined,
172
- isLoading: false,
173
- mutate: jest.fn(),
174
- parties: [],
175
125
  sourceParties: [],
176
- sourcePartiesFilter: () => true,
126
+ isLoading: false,
127
+ error: undefined,
177
128
  sourceTags: [],
129
+ destinationTags: [],
178
130
  });
179
-
180
131
  render(
181
132
  <StockOperationForm
182
133
  stockOperationType={receiptOperationTypeMock as any}
@@ -186,23 +137,17 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
186
137
  promptBeforeClosing={jest.fn()}
187
138
  />,
188
139
  );
189
-
190
140
  expect(screen.getByRole('button', { name: /next/i })).toBeInTheDocument();
191
141
  expect(screen.queryByRole('button', { name: /previous/i })).not.toBeInTheDocument();
192
142
  });
193
-
194
143
  it('should render operation type in title', async () => {
195
- mockUseParties.mockReturnValue({
144
+ (useParties as jest.Mock).mockReturnValue({
196
145
  destinationParties: [],
197
146
  sourceParties: [],
198
147
  isLoading: false,
199
148
  error: undefined,
200
149
  sourceTags: [],
201
150
  destinationTags: [],
202
- parties: [],
203
- mutate: jest.fn(),
204
- sourcePartiesFilter: () => true,
205
- destinationPartiesFilter: () => true,
206
151
  });
207
152
  render(
208
153
  <StockOperationForm
@@ -213,21 +158,17 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
213
158
  promptBeforeClosing={jest.fn()}
214
159
  />,
215
160
  );
216
- expect(screen.getByRole('heading', { name: `${receiptOperationTypeMock.name} Details` })).toBeInTheDocument();
161
+ expect(screen.getByText(`${receiptOperationTypeMock.name} details`)).toBeInTheDocument();
217
162
  });
218
163
 
219
- it("should render combobox with 'from' name and 'choose a source' placeholder for receipt operation", async () => {
220
- mockUseParties.mockReturnValue({
164
+ it("should render combobox with 'from' name and 'chooseAsource' placeholder for receipt operation", async () => {
165
+ (useParties as jest.Mock).mockReturnValue({
221
166
  destinationParties: [],
222
167
  sourceParties: [],
223
168
  isLoading: false,
224
169
  error: undefined,
225
170
  sourceTags: [],
226
171
  destinationTags: [],
227
- parties: [],
228
- mutate: jest.fn(),
229
- sourcePartiesFilter: () => true,
230
- destinationPartiesFilter: () => true,
231
172
  });
232
173
  render(
233
174
  <StockOperationForm
@@ -240,26 +181,21 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
240
181
  );
241
182
  const sourceInput = screen.getByRole('combobox', {
242
183
  name: (_, element) =>
243
- element.getAttribute('placeholder') === 'Choose a source' && element.getAttribute('name') === 'sourceUuid',
184
+ element.getAttribute('placeholder') === 'chooseASource' && element.getAttribute('name') === 'sourceUuid',
244
185
  });
245
186
  expect(sourceInput).toBeInTheDocument();
246
187
  expect(screen.getByRole('combobox', { name: /from/i })).toBeInTheDocument();
247
188
  });
248
189
 
249
190
  it("should render combobox with 'to' name and defaulted to 'main store' location in receipt operation", async () => {
250
- mockUseParties.mockReturnValue({
191
+ (useParties as jest.Mock).mockReturnValue({
251
192
  destinationParties: [],
252
193
  sourceParties: [],
253
194
  isLoading: false,
254
195
  error: undefined,
255
196
  sourceTags: [],
256
197
  destinationTags: [],
257
- parties: [],
258
- mutate: jest.fn(),
259
- sourcePartiesFilter: () => true,
260
- destinationPartiesFilter: () => true,
261
198
  });
262
-
263
199
  render(
264
200
  <StockOperationForm
265
201
  stockOperationType={receiptOperationTypeMock as any}
@@ -269,24 +205,18 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
269
205
  promptBeforeClosing={jest.fn()}
270
206
  />,
271
207
  );
272
-
273
208
  expect(screen.getByRole('combobox', { name: /to/i })).toBeInTheDocument();
274
209
  });
275
210
 
276
211
  it("should render combobox with 'destinationUuid' name and 'chooseADestination' placeholder", async () => {
277
- mockUseParties.mockReturnValue({
212
+ (useParties as jest.Mock).mockReturnValue({
278
213
  destinationParties: [],
279
214
  sourceParties: [],
280
215
  isLoading: false,
281
216
  error: undefined,
282
217
  sourceTags: [],
283
218
  destinationTags: [],
284
- parties: [],
285
- mutate: jest.fn(),
286
- sourcePartiesFilter: () => true,
287
- destinationPartiesFilter: () => true,
288
219
  });
289
-
290
220
  render(
291
221
  <StockOperationForm
292
222
  stockOperationType={receiptOperationTypeMock as any}
@@ -296,31 +226,24 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
296
226
  promptBeforeClosing={jest.fn()}
297
227
  />,
298
228
  );
299
-
300
229
  expect(
301
230
  screen.getByRole('combobox', {
302
231
  name: (_, element) =>
303
- element.getAttribute('placeholder') === 'Choose a destination' &&
232
+ element.getAttribute('placeholder') === 'chooseADestination' &&
304
233
  element.getAttribute('name') === 'destinationUuid',
305
234
  }),
306
235
  ).toBeInTheDocument();
307
236
  expect(screen.getByRole('combobox', { name: /to/i })).toBeInTheDocument();
308
237
  });
309
-
310
- it("should render combobox with 'sourceUuid' name and 'chooseALocation' placeholder for disposal operation", async () => {
311
- mockUseParties.mockReturnValue({
238
+ it("should render combobox with 'sourceUuid' name and 'chooseALocation' placeholder for disposal opertaion", async () => {
239
+ (useParties as jest.Mock).mockReturnValue({
312
240
  destinationParties: [],
313
241
  sourceParties: [],
314
242
  isLoading: false,
315
243
  error: undefined,
316
244
  sourceTags: [],
317
245
  destinationTags: [],
318
- parties: [],
319
- mutate: jest.fn(),
320
- sourcePartiesFilter: () => true,
321
- destinationPartiesFilter: () => true,
322
246
  });
323
-
324
247
  render(
325
248
  <StockOperationForm
326
249
  stockOperationType={disposalOperationTypeMock as any}
@@ -330,30 +253,24 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
330
253
  promptBeforeClosing={jest.fn()}
331
254
  />,
332
255
  );
333
-
334
256
  expect(
335
257
  screen.getByRole('combobox', {
336
258
  name: (_, element) =>
337
- element.getAttribute('placeholder') === 'Choose a location' && element.getAttribute('name') === 'sourceUuid',
259
+ element.getAttribute('placeholder') === 'chooseALocation' && element.getAttribute('name') === 'sourceUuid',
338
260
  }),
339
261
  ).toBeInTheDocument();
340
262
  expect(screen.getByRole('combobox', { name: /location/i })).toBeInTheDocument();
341
263
  });
342
264
 
343
265
  it('should not render reason input field for receipt operation', async () => {
344
- mockUseParties.mockReturnValue({
266
+ (useParties as jest.Mock).mockReturnValue({
345
267
  destinationParties: [],
346
268
  sourceParties: [],
347
269
  isLoading: false,
348
270
  error: undefined,
349
271
  sourceTags: [],
350
272
  destinationTags: [],
351
- parties: [],
352
- mutate: jest.fn(),
353
- sourcePartiesFilter: () => true,
354
- destinationPartiesFilter: () => true,
355
273
  });
356
-
357
274
  render(
358
275
  <StockOperationForm
359
276
  stockOperationType={receiptOperationTypeMock as any}
@@ -365,21 +282,15 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
365
282
  );
366
283
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
367
284
  });
368
-
369
285
  it('should render reason input field for adjustment operation', async () => {
370
- mockUseParties.mockReturnValue({
286
+ (useParties as jest.Mock).mockReturnValue({
371
287
  destinationParties: [],
372
288
  sourceParties: [],
373
289
  isLoading: false,
374
290
  error: undefined,
375
291
  sourceTags: [],
376
292
  destinationTags: [],
377
- parties: [],
378
- mutate: jest.fn(),
379
- sourcePartiesFilter: () => true,
380
- destinationPartiesFilter: () => true,
381
293
  });
382
-
383
294
  render(
384
295
  <StockOperationForm
385
296
  stockOperationType={adjustmentOpeationTypeMock as any}
@@ -391,21 +302,15 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
391
302
  );
392
303
  expect(screen.getByRole('combobox', { name: /reason/i })).toBeInTheDocument();
393
304
  });
394
-
395
305
  it('should not render reason input field for opening stock operation', async () => {
396
- mockUseParties.mockReturnValue({
306
+ (useParties as jest.Mock).mockReturnValue({
397
307
  destinationParties: [],
398
308
  sourceParties: [],
399
309
  isLoading: false,
400
310
  error: undefined,
401
311
  sourceTags: [],
402
312
  destinationTags: [],
403
- parties: [],
404
- mutate: jest.fn(),
405
- sourcePartiesFilter: () => true,
406
- destinationPartiesFilter: () => true,
407
313
  });
408
-
409
314
  render(
410
315
  <StockOperationForm
411
316
  stockOperationType={openingStockOperationTypeMock as any}
@@ -417,21 +322,15 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
417
322
  );
418
323
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
419
324
  });
420
-
421
325
  it('should not render reason input field for requisition operation', async () => {
422
- mockUseParties.mockReturnValue({
326
+ (useParties as jest.Mock).mockReturnValue({
423
327
  destinationParties: [],
424
328
  sourceParties: [],
425
329
  isLoading: false,
426
330
  error: undefined,
427
331
  sourceTags: [],
428
332
  destinationTags: [],
429
- parties: [],
430
- mutate: jest.fn(),
431
- sourcePartiesFilter: () => true,
432
- destinationPartiesFilter: () => true,
433
333
  });
434
-
435
334
  render(
436
335
  <StockOperationForm
437
336
  stockOperationType={requisitionOperationTypeMock as any}
@@ -443,21 +342,15 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
443
342
  );
444
343
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
445
344
  });
446
-
447
345
  it('should not render reason input field for return operation', async () => {
448
- mockUseParties.mockReturnValue({
346
+ (useParties as jest.Mock).mockReturnValue({
449
347
  destinationParties: [],
450
348
  sourceParties: [],
451
349
  isLoading: false,
452
350
  error: undefined,
453
351
  sourceTags: [],
454
352
  destinationTags: [],
455
- parties: [],
456
- mutate: jest.fn(),
457
- sourcePartiesFilter: () => true,
458
- destinationPartiesFilter: () => true,
459
353
  });
460
-
461
354
  render(
462
355
  <StockOperationForm
463
356
  stockOperationType={returnOperationTypeMock as any}
@@ -467,24 +360,17 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
467
360
  promptBeforeClosing={jest.fn()}
468
361
  />,
469
362
  );
470
-
471
363
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
472
364
  });
473
-
474
365
  it('should not render reason input field for issue operation', async () => {
475
- mockUseParties.mockReturnValue({
366
+ (useParties as jest.Mock).mockReturnValue({
476
367
  destinationParties: [],
477
368
  sourceParties: [],
478
369
  isLoading: false,
479
370
  error: undefined,
480
371
  sourceTags: [],
481
372
  destinationTags: [],
482
- parties: [],
483
- mutate: jest.fn(),
484
- sourcePartiesFilter: () => true,
485
- destinationPartiesFilter: () => true,
486
373
  });
487
-
488
374
  render(
489
375
  <StockOperationForm
490
376
  stockOperationType={stockIssueOperationtypeMock as any}
@@ -494,24 +380,17 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
494
380
  promptBeforeClosing={jest.fn()}
495
381
  />,
496
382
  );
497
-
498
383
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
499
384
  });
500
-
501
385
  it('should not render reason input field for tranfer out operation', async () => {
502
- mockUseParties.mockReturnValue({
386
+ (useParties as jest.Mock).mockReturnValue({
503
387
  destinationParties: [],
504
388
  sourceParties: [],
505
389
  isLoading: false,
506
390
  error: undefined,
507
391
  sourceTags: [],
508
392
  destinationTags: [],
509
- parties: [],
510
- mutate: jest.fn(),
511
- sourcePartiesFilter: () => true,
512
- destinationPartiesFilter: () => true,
513
393
  });
514
-
515
394
  render(
516
395
  <StockOperationForm
517
396
  stockOperationType={tranferOutOperationTypeMock as any}
@@ -521,24 +400,17 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
521
400
  promptBeforeClosing={jest.fn()}
522
401
  />,
523
402
  );
524
-
525
403
  expect(screen.queryByRole('combobox', { name: /reason/i })).not.toBeInTheDocument();
526
404
  });
527
-
528
405
  it('should render reason input field for disposal operation', async () => {
529
- mockUseParties.mockReturnValue({
406
+ (useParties as jest.Mock).mockReturnValue({
530
407
  destinationParties: [],
531
408
  sourceParties: [],
532
409
  isLoading: false,
533
410
  error: undefined,
534
411
  sourceTags: [],
535
412
  destinationTags: [],
536
- parties: [],
537
- mutate: jest.fn(),
538
- sourcePartiesFilter: () => true,
539
- destinationPartiesFilter: () => true,
540
413
  });
541
-
542
414
  render(
543
415
  <StockOperationForm
544
416
  stockOperationType={disposalOperationTypeMock as any}
@@ -550,21 +422,15 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
550
422
  );
551
423
  expect(screen.getByRole('combobox', { name: /reason/i })).toBeInTheDocument();
552
424
  });
553
-
554
425
  it('should render reason input field for stock take operation', async () => {
555
- mockUseParties.mockReturnValue({
426
+ (useParties as jest.Mock).mockReturnValue({
556
427
  destinationParties: [],
557
428
  sourceParties: [],
558
429
  isLoading: false,
559
430
  error: undefined,
560
431
  sourceTags: [],
561
432
  destinationTags: [],
562
- parties: [],
563
- mutate: jest.fn(),
564
- sourcePartiesFilter: () => true,
565
- destinationPartiesFilter: () => true,
566
433
  });
567
-
568
434
  render(
569
435
  <StockOperationForm
570
436
  stockOperationType={stockTakeOperationTypeMock as any}
@@ -574,7 +440,6 @@ describe('Stock Operation step 1 (baseoperation details)', () => {
574
440
  promptBeforeClosing={jest.fn()}
575
441
  />,
576
442
  );
577
-
578
443
  expect(screen.getByRole('combobox', { name: /reason/i })).toBeInTheDocument();
579
444
  });
580
445
  });