@openmrs/esm-react-utils 5.3.3-pre.1237 → 5.3.3-pre.1247

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 (48) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/__mocks__/openmrs-esm-state.mock.ts +8 -20
  3. package/dist/openmrs-esm-react-utils.js.map +1 -1
  4. package/jest.config.js +9 -11
  5. package/package.json +7 -7
  6. package/src/ComponentContext.ts +2 -2
  7. package/src/ConfigurableLink.test.tsx +19 -23
  8. package/src/ConfigurableLink.tsx +5 -19
  9. package/src/Extension.tsx +36 -76
  10. package/src/ExtensionSlot.tsx +15 -24
  11. package/src/UserHasAccess.tsx +3 -7
  12. package/src/extensions.test.tsx +100 -179
  13. package/src/getLifecycle.ts +8 -18
  14. package/src/index.ts +31 -31
  15. package/src/openmrsComponentDecorator.test.tsx +12 -12
  16. package/src/openmrsComponentDecorator.tsx +12 -26
  17. package/src/public.ts +27 -27
  18. package/src/setup-tests.js +4 -4
  19. package/src/useAbortController.test.tsx +8 -8
  20. package/src/useAbortController.ts +1 -1
  21. package/src/useAssignedExtensionIds.ts +4 -5
  22. package/src/useAssignedExtensions.ts +3 -7
  23. package/src/useBodyScrollLock.ts +2 -2
  24. package/src/useConfig.test.tsx +96 -112
  25. package/src/useConfig.ts +15 -43
  26. package/src/useConnectedExtensions.ts +8 -17
  27. package/src/useConnectivity.ts +3 -6
  28. package/src/useDebounce.ts +1 -1
  29. package/src/useExtensionInternalStore.ts +3 -8
  30. package/src/useExtensionSlot.ts +5 -7
  31. package/src/useExtensionSlotMeta.ts +5 -11
  32. package/src/useExtensionStore.ts +3 -5
  33. package/src/useFeatureFlag.ts +4 -4
  34. package/src/useForceUpdate.ts +1 -1
  35. package/src/useLayoutType.ts +12 -13
  36. package/src/useLocations.tsx +3 -3
  37. package/src/useOnClickOutside.test.tsx +10 -10
  38. package/src/useOnClickOutside.ts +2 -5
  39. package/src/useOpenmrsSWR.ts +9 -9
  40. package/src/usePagination.ts +6 -18
  41. package/src/usePatient.ts +9 -13
  42. package/src/useSession.test.tsx +35 -43
  43. package/src/useSession.ts +9 -13
  44. package/src/useStore.test.ts +11 -13
  45. package/src/useStore.ts +10 -31
  46. package/src/useVisit.ts +14 -37
  47. package/src/useVisitTypes.ts +3 -3
  48. package/webpack.config.js +14 -14
package/src/public.ts CHANGED
@@ -1,27 +1,27 @@
1
- export { type ExtensionData } from "./ComponentContext";
2
- export * from "./ConfigurableLink";
3
- export * from "./Extension";
4
- export * from "./ExtensionSlot";
5
- export * from "./UserHasAccess";
6
- export * from "./getLifecycle";
7
- export * from "./useAbortController";
8
- export * from "./useAssignedExtensions";
9
- export * from "./useAssignedExtensionIds";
10
- export * from "./useBodyScrollLock";
11
- export * from "./useConfig";
12
- export * from "./useConnectedExtensions";
13
- export * from "./useConnectivity";
14
- export * from "./useDebounce";
15
- export * from "./useExtensionSlotMeta";
16
- export * from "./useExtensionStore";
17
- export * from "./useFeatureFlag";
18
- export * from "./useLayoutType";
19
- export * from "./useLocations";
20
- export * from "./useOnClickOutside";
21
- export * from "./useOpenmrsSWR";
22
- export * from "./usePatient";
23
- export { useSession } from "./useSession";
24
- export * from "./useStore";
25
- export * from "./useVisit";
26
- export * from "./useVisitTypes";
27
- export * from "./usePagination";
1
+ export { type ExtensionData } from './ComponentContext';
2
+ export * from './ConfigurableLink';
3
+ export * from './Extension';
4
+ export * from './ExtensionSlot';
5
+ export * from './UserHasAccess';
6
+ export * from './getLifecycle';
7
+ export * from './useAbortController';
8
+ export * from './useAssignedExtensions';
9
+ export * from './useAssignedExtensionIds';
10
+ export * from './useBodyScrollLock';
11
+ export * from './useConfig';
12
+ export * from './useConnectedExtensions';
13
+ export * from './useConnectivity';
14
+ export * from './useDebounce';
15
+ export * from './useExtensionSlotMeta';
16
+ export * from './useExtensionStore';
17
+ export * from './useFeatureFlag';
18
+ export * from './useLayoutType';
19
+ export * from './useLocations';
20
+ export * from './useOnClickOutside';
21
+ export * from './useOpenmrsSWR';
22
+ export * from './usePatient';
23
+ export { useSession } from './useSession';
24
+ export * from './useStore';
25
+ export * from './useVisit';
26
+ export * from './useVisitTypes';
27
+ export * from './usePagination';
@@ -1,5 +1,5 @@
1
- import "@testing-library/jest-dom/extend-expect";
1
+ import '@testing-library/jest-dom/extend-expect';
2
2
 
3
- window.openmrsBase = "/openmrs";
4
- window.spaBase = "/spa";
5
- window.getOpenmrsSpaBase = () => "/openmrs/spa/";
3
+ window.openmrsBase = '/openmrs';
4
+ window.spaBase = '/spa';
5
+ window.getOpenmrsSpaBase = () => '/openmrs/spa/';
@@ -1,16 +1,16 @@
1
- import { renderHook, cleanup } from "@testing-library/react";
2
- import "@testing-library/jest-dom/extend-expect";
3
- import useAbortController from "./useAbortController";
1
+ import { renderHook, cleanup } from '@testing-library/react';
2
+ import '@testing-library/jest-dom/extend-expect';
3
+ import useAbortController from './useAbortController';
4
4
 
5
- describe("useAbortController", () => {
5
+ describe('useAbortController', () => {
6
6
  afterEach(cleanup);
7
7
 
8
- it("returns an AbortController", () => {
8
+ it('returns an AbortController', () => {
9
9
  const { result } = renderHook(() => useAbortController());
10
10
  expect(result.current).not.toBeNull();
11
11
  });
12
12
 
13
- it("returns a consistent AbortController across re-renders", () => {
13
+ it('returns a consistent AbortController across re-renders', () => {
14
14
  const { result, rerender } = renderHook(() => useAbortController());
15
15
  const firstAc = result.current;
16
16
 
@@ -19,7 +19,7 @@ describe("useAbortController", () => {
19
19
  expect(result.current).toBe(firstAc);
20
20
  });
21
21
 
22
- it("returns a new AbortController after the previous controller has been aborted", () => {
22
+ it('returns a new AbortController after the previous controller has been aborted', () => {
23
23
  const { result, rerender } = renderHook(() => useAbortController());
24
24
  const firstAc = result.current;
25
25
 
@@ -30,7 +30,7 @@ describe("useAbortController", () => {
30
30
  expect(result.current).not.toBe(firstAc);
31
31
  });
32
32
 
33
- it("aborts the AbortController when the component is unmounted", () => {
33
+ it('aborts the AbortController when the component is unmounted', () => {
34
34
  const { result, unmount } = renderHook(() => useAbortController());
35
35
 
36
36
  expect(result.current.signal.aborted).toBe(false);
@@ -1,5 +1,5 @@
1
1
  /** @module @category Utility */
2
- import { useEffect, useRef } from "react";
2
+ import { useEffect, useRef } from 'react';
3
3
 
4
4
  /**
5
5
  * @beta
@@ -1,7 +1,7 @@
1
1
  /** @module @category Extension */
2
- import { useEffect, useState } from "react";
3
- import { getExtensionStore } from "@openmrs/esm-extensions";
4
- import isEqual from "lodash-es/isEqual";
2
+ import { useEffect, useState } from 'react';
3
+ import { getExtensionStore } from '@openmrs/esm-extensions';
4
+ import isEqual from 'lodash-es/isEqual';
5
5
 
6
6
  /**
7
7
  * Gets the assigned extension ids for a given extension slot name.
@@ -15,8 +15,7 @@ export function useAssignedExtensionIds(slotName: string) {
15
15
 
16
16
  useEffect(() => {
17
17
  return getExtensionStore().subscribe((state) => {
18
- const newIds =
19
- state.slots[slotName]?.assignedExtensions.map((e) => e.id) ?? [];
18
+ const newIds = state.slots[slotName]?.assignedExtensions.map((e) => e.id) ?? [];
20
19
  if (!isEqual(newIds, ids)) {
21
20
  setIds(newIds);
22
21
  }
@@ -1,11 +1,7 @@
1
1
  /** @module @category Extension */
2
- import { useEffect, useState } from "react";
3
- import {
4
- AssignedExtension,
5
- ExtensionStore,
6
- getExtensionStore,
7
- } from "@openmrs/esm-extensions";
8
- import isEqual from "lodash-es/isEqual";
2
+ import { useEffect, useState } from 'react';
3
+ import { AssignedExtension, ExtensionStore, getExtensionStore } from '@openmrs/esm-extensions';
4
+ import isEqual from 'lodash-es/isEqual';
9
5
 
10
6
  /**
11
7
  * Gets the assigned extensions for a given extension slot name.
@@ -1,11 +1,11 @@
1
1
  /** @module @category UI */
2
- import { useEffect } from "react";
2
+ import { useEffect } from 'react';
3
3
 
4
4
  export function useBodyScrollLock(active: boolean) {
5
5
  useEffect(() => {
6
6
  if (active) {
7
7
  const original = window.getComputedStyle(document.body).overflow;
8
- document.body.style.overflow = "hidden";
8
+ document.body.style.overflow = 'hidden';
9
9
  return () => {
10
10
  document.body.style.overflow = original;
11
11
  };
@@ -1,18 +1,17 @@
1
- import React from "react";
2
- import { render, cleanup, screen, waitFor, act } from "@testing-library/react";
1
+ import React from 'react';
2
+ import { render, cleanup, screen, waitFor, act } from '@testing-library/react';
3
3
  import {
4
4
  defineConfigSchema,
5
5
  temporaryConfigStore,
6
6
  provide,
7
7
  configInternalStore,
8
8
  ConfigInternalStore,
9
- } from "@openmrs/esm-config";
10
- import { MockedStore } from "../__mocks__/openmrs-esm-state.mock";
11
- import { useConfig } from "./useConfig";
12
- import { ComponentContext } from "./ComponentContext";
9
+ } from '@openmrs/esm-config';
10
+ import { MockedStore } from '../__mocks__/openmrs-esm-state.mock';
11
+ import { useConfig } from './useConfig';
12
+ import { ComponentContext } from './ComponentContext';
13
13
 
14
- const mockConfigInternalStore =
15
- configInternalStore as MockedStore<ConfigInternalStore>;
14
+ const mockConfigInternalStore = configInternalStore as MockedStore<ConfigInternalStore>;
16
15
 
17
16
  function RenderConfig(props) {
18
17
  const config = useConfig();
@@ -34,87 +33,83 @@ describe(`useConfig in root context`, () => {
34
33
  afterEach(clearConfig);
35
34
 
36
35
  it(`can return config as a react hook`, async () => {
37
- defineConfigSchema("foo-module", {
36
+ defineConfigSchema('foo-module', {
38
37
  thing: {
39
- _default: "The first thing",
38
+ _default: 'The first thing',
40
39
  },
41
40
  });
42
41
 
43
42
  render(
44
43
  <React.Suspense fallback={<div>Suspense!</div>}>
45
- <ComponentContext.Provider value={{ moduleName: "foo-module" }}>
44
+ <ComponentContext.Provider value={{ moduleName: 'foo-module' }}>
46
45
  <RenderConfig configKey="thing" />
47
46
  </ComponentContext.Provider>
48
- </React.Suspense>
47
+ </React.Suspense>,
49
48
  );
50
49
 
51
- await waitFor(() =>
52
- expect(screen.findByText("The first thing")).toBeTruthy()
53
- );
50
+ await waitFor(() => expect(screen.findByText('The first thing')).toBeTruthy());
54
51
  });
55
52
 
56
53
  it(`can handle multiple calls to useConfig from different modules`, async () => {
57
- defineConfigSchema("foo-module", {
54
+ defineConfigSchema('foo-module', {
58
55
  thing: {
59
- _default: "foo thing",
56
+ _default: 'foo thing',
60
57
  },
61
58
  });
62
59
 
63
- defineConfigSchema("bar-module", {
60
+ defineConfigSchema('bar-module', {
64
61
  thing: {
65
- _default: "bar thing",
62
+ _default: 'bar thing',
66
63
  },
67
64
  });
68
65
 
69
66
  render(
70
67
  <React.Suspense fallback={<div>Suspense!</div>}>
71
- <ComponentContext.Provider value={{ moduleName: "foo-module" }}>
68
+ <ComponentContext.Provider value={{ moduleName: 'foo-module' }}>
72
69
  <RenderConfig configKey="thing" />
73
70
  </ComponentContext.Provider>
74
- </React.Suspense>
71
+ </React.Suspense>,
75
72
  );
76
73
 
77
- await waitFor(() => expect(screen.findByText("foo thing")).toBeTruthy());
74
+ await waitFor(() => expect(screen.findByText('foo thing')).toBeTruthy());
78
75
 
79
76
  await cleanup();
80
77
 
81
78
  render(
82
79
  <React.Suspense fallback={<div>Suspense!</div>}>
83
- <ComponentContext.Provider value={{ moduleName: "bar-module" }}>
80
+ <ComponentContext.Provider value={{ moduleName: 'bar-module' }}>
84
81
  <RenderConfig configKey="thing" />
85
82
  </ComponentContext.Provider>
86
- </React.Suspense>
83
+ </React.Suspense>,
87
84
  );
88
85
 
89
- await waitFor(() => expect(screen.findByText("bar thing")).toBeTruthy());
86
+ await waitFor(() => expect(screen.findByText('bar thing')).toBeTruthy());
90
87
  });
91
88
 
92
- it("updates with a new value when the temporary config is updated", async () => {
93
- defineConfigSchema("foo-module", {
89
+ it('updates with a new value when the temporary config is updated', async () => {
90
+ defineConfigSchema('foo-module', {
94
91
  thing: {
95
- _default: "The first thing",
92
+ _default: 'The first thing',
96
93
  },
97
94
  });
98
95
 
99
96
  render(
100
97
  <React.Suspense fallback={<div>Suspense!</div>}>
101
- <ComponentContext.Provider value={{ moduleName: "foo-module" }}>
98
+ <ComponentContext.Provider value={{ moduleName: 'foo-module' }}>
102
99
  <RenderConfig configKey="thing" />
103
100
  </ComponentContext.Provider>
104
- </React.Suspense>
101
+ </React.Suspense>,
105
102
  );
106
103
 
107
- await waitFor(() =>
108
- expect(screen.findByText("The first thing")).toBeTruthy()
109
- );
104
+ await waitFor(() => expect(screen.findByText('The first thing')).toBeTruthy());
110
105
 
111
106
  act(() =>
112
107
  temporaryConfigStore.setState({
113
- config: { "foo-module": { thing: "A new thing" } },
114
- })
108
+ config: { 'foo-module': { thing: 'A new thing' } },
109
+ }),
115
110
  );
116
111
 
117
- await waitFor(() => expect(screen.findByText("A new thing")).toBeTruthy());
112
+ await waitFor(() => expect(screen.findByText('A new thing')).toBeTruthy());
118
113
  });
119
114
  });
120
115
 
@@ -123,9 +118,9 @@ describe(`useConfig in an extension`, () => {
123
118
  afterEach(cleanup);
124
119
 
125
120
  it(`can return extension config as a react hook`, async () => {
126
- defineConfigSchema("ext-module", {
121
+ defineConfigSchema('ext-module', {
127
122
  thing: {
128
- _default: "The basics",
123
+ _default: 'The basics',
129
124
  },
130
125
  });
131
126
 
@@ -133,32 +128,32 @@ describe(`useConfig in an extension`, () => {
133
128
  <React.Suspense fallback={<div>Suspense!</div>}>
134
129
  <ComponentContext.Provider
135
130
  value={{
136
- moduleName: "ext-module",
131
+ moduleName: 'ext-module',
137
132
  extension: {
138
- extensionSlotName: "fooSlot",
139
- extensionSlotModuleName: "slot-mod",
140
- extensionId: "barExt#id1",
133
+ extensionSlotName: 'fooSlot',
134
+ extensionSlotModuleName: 'slot-mod',
135
+ extensionId: 'barExt#id1',
141
136
  },
142
137
  }}
143
138
  >
144
139
  <RenderConfig configKey="thing" />
145
140
  </ComponentContext.Provider>
146
- </React.Suspense>
141
+ </React.Suspense>,
147
142
  );
148
143
 
149
- await waitFor(() => expect(screen.findByText("The basics")).toBeTruthy());
144
+ await waitFor(() => expect(screen.findByText('The basics')).toBeTruthy());
150
145
  });
151
146
 
152
147
  it(`can handle multiple extensions`, async () => {
153
- defineConfigSchema("first-module", {
148
+ defineConfigSchema('first-module', {
154
149
  thing: {
155
- _default: "first thing",
150
+ _default: 'first thing',
156
151
  },
157
152
  });
158
153
 
159
- defineConfigSchema("second-module", {
154
+ defineConfigSchema('second-module', {
160
155
  thing: {
161
- _default: "second thing",
156
+ _default: 'second thing',
162
157
  },
163
158
  });
164
159
 
@@ -166,11 +161,11 @@ describe(`useConfig in an extension`, () => {
166
161
  <React.Suspense fallback={<div>Suspense!</div>}>
167
162
  <ComponentContext.Provider
168
163
  value={{
169
- moduleName: "first-module",
164
+ moduleName: 'first-module',
170
165
  extension: {
171
- extensionSlotName: "fooSlot",
172
- extensionSlotModuleName: "slot-mod",
173
- extensionId: "fooExt#id1",
166
+ extensionSlotName: 'fooSlot',
167
+ extensionSlotModuleName: 'slot-mod',
168
+ extensionId: 'fooExt#id1',
174
169
  },
175
170
  }}
176
171
  >
@@ -178,36 +173,36 @@ describe(`useConfig in an extension`, () => {
178
173
  </ComponentContext.Provider>
179
174
  <ComponentContext.Provider
180
175
  value={{
181
- moduleName: "second-module",
176
+ moduleName: 'second-module',
182
177
  extension: {
183
- extensionSlotName: "fooSlot",
184
- extensionSlotModuleName: "slot-mod",
185
- extensionId: "barExt",
178
+ extensionSlotName: 'fooSlot',
179
+ extensionSlotModuleName: 'slot-mod',
180
+ extensionId: 'barExt',
186
181
  },
187
182
  }}
188
183
  >
189
184
  <RenderConfig configKey="thing" />
190
185
  </ComponentContext.Provider>
191
- </React.Suspense>
186
+ </React.Suspense>,
192
187
  );
193
188
 
194
- await waitFor(() => expect(screen.findByText("first thing")).toBeTruthy());
195
- await waitFor(() => expect(screen.findByText("second thing")).toBeTruthy());
189
+ await waitFor(() => expect(screen.findByText('first thing')).toBeTruthy());
190
+ await waitFor(() => expect(screen.findByText('second thing')).toBeTruthy());
196
191
  });
197
192
 
198
- it("can handle multiple extension slots", async () => {
199
- defineConfigSchema("extension-module", {
193
+ it('can handle multiple extension slots', async () => {
194
+ defineConfigSchema('extension-module', {
200
195
  thing: {
201
- _default: "old extension thing",
196
+ _default: 'old extension thing',
202
197
  },
203
198
  });
204
199
 
205
200
  provide({
206
- "slot-2-module": {
201
+ 'slot-2-module': {
207
202
  extensions: {
208
203
  slot2: {
209
204
  configure: {
210
- fooExt: { thing: "a different thing" },
205
+ fooExt: { thing: 'a different thing' },
211
206
  },
212
207
  },
213
208
  },
@@ -218,11 +213,11 @@ describe(`useConfig in an extension`, () => {
218
213
  <React.Suspense fallback={<div>Suspense!</div>}>
219
214
  <ComponentContext.Provider
220
215
  value={{
221
- moduleName: "extension-module",
216
+ moduleName: 'extension-module',
222
217
  extension: {
223
- extensionSlotName: "slot1",
224
- extensionSlotModuleName: "slot-1-module",
225
- extensionId: "fooExt",
218
+ extensionSlotName: 'slot1',
219
+ extensionSlotModuleName: 'slot-1-module',
220
+ extensionId: 'fooExt',
226
221
  },
227
222
  }}
228
223
  >
@@ -230,31 +225,27 @@ describe(`useConfig in an extension`, () => {
230
225
  </ComponentContext.Provider>
231
226
  <ComponentContext.Provider
232
227
  value={{
233
- moduleName: "extension-module",
228
+ moduleName: 'extension-module',
234
229
  extension: {
235
- extensionSlotName: "slot2",
236
- extensionSlotModuleName: "slot-2-module",
237
- extensionId: "fooExt",
230
+ extensionSlotName: 'slot2',
231
+ extensionSlotModuleName: 'slot-2-module',
232
+ extensionId: 'fooExt',
238
233
  },
239
234
  }}
240
235
  >
241
236
  <RenderConfig configKey="thing" />
242
237
  </ComponentContext.Provider>
243
- </React.Suspense>
238
+ </React.Suspense>,
244
239
  );
245
240
 
246
- await waitFor(() =>
247
- expect(screen.findByText("old extension thing")).toBeTruthy()
248
- );
249
- await waitFor(() =>
250
- expect(screen.findByText("a different thing")).toBeTruthy()
251
- );
241
+ await waitFor(() => expect(screen.findByText('old extension thing')).toBeTruthy());
242
+ await waitFor(() => expect(screen.findByText('a different thing')).toBeTruthy());
252
243
  });
253
244
 
254
- it("updates with a new value when the temporary config is updated", async () => {
255
- defineConfigSchema("ext-module", {
245
+ it('updates with a new value when the temporary config is updated', async () => {
246
+ defineConfigSchema('ext-module', {
256
247
  thing: {
257
- _default: "The first thing",
248
+ _default: 'The first thing',
258
249
  },
259
250
  });
260
251
 
@@ -262,35 +253,33 @@ describe(`useConfig in an extension`, () => {
262
253
  <React.Suspense fallback={<div>Suspense!</div>}>
263
254
  <ComponentContext.Provider
264
255
  value={{
265
- moduleName: "ext-module",
256
+ moduleName: 'ext-module',
266
257
  extension: {
267
- extensionSlotName: "fooSlot",
268
- extensionSlotModuleName: "slot-module",
269
- extensionId: "barExt#id1",
258
+ extensionSlotName: 'fooSlot',
259
+ extensionSlotModuleName: 'slot-module',
260
+ extensionId: 'barExt#id1',
270
261
  },
271
262
  }}
272
263
  >
273
264
  <RenderConfig configKey="thing" />
274
265
  </ComponentContext.Provider>
275
- </React.Suspense>
266
+ </React.Suspense>,
276
267
  );
277
268
 
278
- await waitFor(() =>
279
- expect(screen.findByText("The first thing")).toBeTruthy()
280
- );
269
+ await waitFor(() => expect(screen.findByText('The first thing')).toBeTruthy());
281
270
 
282
- const newConfig = { "ext-module": { thing: "A new thing" } };
271
+ const newConfig = { 'ext-module': { thing: 'A new thing' } };
283
272
  act(() => temporaryConfigStore.setState({ config: newConfig }));
284
273
 
285
- await waitFor(() => expect(screen.findByText("A new thing")).toBeTruthy());
274
+ await waitFor(() => expect(screen.findByText('A new thing')).toBeTruthy());
286
275
 
287
276
  const newConfig2 = {
288
- "slot-module": {
277
+ 'slot-module': {
289
278
  extensions: {
290
279
  fooSlot: {
291
280
  configure: {
292
- "barExt#id1": {
293
- thing: "Yet another thing",
281
+ 'barExt#id1': {
282
+ thing: 'Yet another thing',
294
283
  },
295
284
  },
296
285
  },
@@ -299,21 +288,19 @@ describe(`useConfig in an extension`, () => {
299
288
  };
300
289
  act(() => temporaryConfigStore.setState({ config: newConfig2 }));
301
290
 
302
- await waitFor(() =>
303
- expect(screen.findByText("Yet another thing")).toBeTruthy()
304
- );
291
+ await waitFor(() => expect(screen.findByText('Yet another thing')).toBeTruthy());
305
292
  });
306
293
 
307
294
  it("can optionally load an external module's configuration", async () => {
308
- defineConfigSchema("first-module", {
295
+ defineConfigSchema('first-module', {
309
296
  thing: {
310
- _default: "first thing",
297
+ _default: 'first thing',
311
298
  },
312
299
  });
313
300
 
314
- defineConfigSchema("second-module", {
301
+ defineConfigSchema('second-module', {
315
302
  thing: {
316
- _default: "second thing",
303
+ _default: 'second thing',
317
304
  },
318
305
  });
319
306
 
@@ -321,22 +308,19 @@ describe(`useConfig in an extension`, () => {
321
308
  <React.Suspense fallback={<div>Suspense!</div>}>
322
309
  <ComponentContext.Provider
323
310
  value={{
324
- moduleName: "first-module",
311
+ moduleName: 'first-module',
325
312
  extension: {
326
- extensionSlotName: "fooSlot",
327
- extensionSlotModuleName: "slot-mod",
328
- extensionId: "fooExt#id1",
313
+ extensionSlotName: 'fooSlot',
314
+ extensionSlotModuleName: 'slot-mod',
315
+ extensionId: 'fooExt#id1',
329
316
  },
330
317
  }}
331
318
  >
332
- <RenderExternalConfig
333
- externalModuleName="second-module"
334
- configKey="thing"
335
- />
319
+ <RenderExternalConfig externalModuleName="second-module" configKey="thing" />
336
320
  </ComponentContext.Provider>
337
- </React.Suspense>
321
+ </React.Suspense>,
338
322
  );
339
323
 
340
- await waitFor(() => expect(screen.findByText("second thing")).toBeTruthy());
324
+ await waitFor(() => expect(screen.findByText('second thing')).toBeTruthy());
341
325
  });
342
326
  });