@terreno/admin-frontend 0.14.0 → 0.14.1

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 (47) hide show
  1. package/dist/AdminObjectPicker.js +1 -0
  2. package/dist/AdminObjectPicker.js.map +1 -1
  3. package/dist/AdminVersionConfig.js +1 -0
  4. package/dist/AdminVersionConfig.js.map +1 -1
  5. package/dist/ConsentFormEditor.js +42 -28
  6. package/dist/ConsentFormEditor.js.map +1 -1
  7. package/dist/useAdminApi.js +1 -2
  8. package/dist/useAdminApi.js.map +1 -1
  9. package/dist/useAdminConfig.js +1 -0
  10. package/dist/useAdminConfig.js.map +1 -1
  11. package/dist/useAdminScripts.js +1 -0
  12. package/dist/useAdminScripts.js.map +1 -1
  13. package/dist/useConfigurationApi.js +1 -0
  14. package/dist/useConfigurationApi.js.map +1 -1
  15. package/dist/useDocumentStorageApi.js +1 -0
  16. package/dist/useDocumentStorageApi.js.map +1 -1
  17. package/package.json +2 -2
  18. package/src/AdminFieldRenderer.test.tsx +47 -22
  19. package/src/AdminModelForm.test.tsx +145 -40
  20. package/src/AdminModelList.test.tsx +13 -5
  21. package/src/AdminModelTable.test.tsx +57 -31
  22. package/src/AdminObjectPicker.tsx +1 -0
  23. package/src/AdminPrimitiveArrayField.test.tsx +13 -10
  24. package/src/AdminScriptList.test.tsx +6 -4
  25. package/src/AdminScriptRunModal.test.tsx +4 -2
  26. package/src/AdminVersionConfig.test.tsx +28 -23
  27. package/src/AdminVersionConfig.tsx +1 -0
  28. package/src/CheckboxListEditor.test.tsx +8 -6
  29. package/src/ConfigurationScreen.test.tsx +15 -11
  30. package/src/ConsentFormEditor.test.tsx +94 -75
  31. package/src/ConsentFormEditor.tsx +44 -33
  32. package/src/ConsentFormList.test.tsx +27 -10
  33. package/src/ConsentResponseViewer.test.tsx +14 -12
  34. package/src/DocumentStorageBrowser.test.tsx +68 -42
  35. package/src/LocaleContentEditor.test.tsx +27 -18
  36. package/src/isolated/AdminFieldRenderer.isolated.tsx +4 -2
  37. package/src/isolated/AdminNestedArrayField.isolated.tsx +48 -36
  38. package/src/isolated/AdminObjectPicker.isolated.tsx +30 -26
  39. package/src/isolated/AdminRefField.isolated.tsx +3 -1
  40. package/src/isolated/AdminScriptRunModal.isolated.tsx +23 -17
  41. package/src/isolated/DocumentStorageBrowser.isolated.tsx +79 -63
  42. package/src/isolated/hooks.isolated.tsx +39 -33
  43. package/src/useAdminApi.ts +1 -2
  44. package/src/useAdminConfig.ts +1 -0
  45. package/src/useAdminScripts.ts +1 -0
  46. package/src/useConfigurationApi.ts +1 -0
  47. package/src/useDocumentStorageApi.ts +1 -0
@@ -1,12 +1,16 @@
1
+ // noExplicitAny: test mocks use type-erased RTK Query API doubles and UNSAFE_root traversal
1
2
  // biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
2
3
  import {beforeEach, describe, expect, it, mock} from "bun:test";
3
4
  import {renderWithTheme} from "@terreno/ui/src/test-utils";
4
5
  import React from "react";
5
6
  import {Platform} from "react-native";
7
+ import type {ReactTestInstance} from "react-test-renderer";
6
8
  import {act, fireEvent} from "../../../ui/node_modules/@testing-library/react-native";
9
+ import type {AdminApi} from "../types";
7
10
 
8
11
  mock.module("react-native-webview", () => ({
9
- WebView: (props: any) => React.createElement("WebView", {...props, testID: "mock-webview"}),
12
+ WebView: (props: Record<string, unknown>) =>
13
+ React.createElement("WebView", {...props, testID: "mock-webview"}),
10
14
  }));
11
15
 
12
16
  // Mock @terreno/ui to render Modal children inline so we can interact with
@@ -14,16 +18,17 @@ mock.module("react-native-webview", () => ({
14
18
  mock.module("@terreno/ui", () => {
15
19
  const RN = require("react-native");
16
20
  const ReactMod = require("react");
17
- const Box = ({children, ...rest}: any) => ReactMod.createElement(RN.View, rest, children);
18
- const Button = ({text, onClick, iconName, testID}: any) =>
21
+ const Box = ({children, ...rest}: Record<string, unknown>) =>
22
+ ReactMod.createElement(RN.View, rest, children);
23
+ const Button = ({text, onClick, iconName, testID}: Record<string, unknown>) =>
19
24
  ReactMod.createElement(
20
25
  RN.Pressable,
21
26
  {onPress: onClick, testID: testID ?? `btn-${iconName ?? text}`},
22
27
  ReactMod.createElement(RN.Text, {}, text)
23
28
  );
24
- const DataTable = ({data, customColumnComponentMap, columns}: any) => {
25
- const rows = (data ?? []).map((row: any[], rowIdx: number) => {
26
- const cells = row.map((cell: any, cellIdx: number) => {
29
+ const DataTable = ({data, customColumnComponentMap, columns}: Record<string, unknown>) => {
30
+ const rows = ((data as unknown[]) ?? []).map((row: unknown[], rowIdx: number) => {
31
+ const cells = row.map((cell: unknown, cellIdx: number) => {
27
32
  const col = columns[cellIdx];
28
33
  const CustomComp = customColumnComponentMap?.[col.columnType];
29
34
  if (CustomComp) {
@@ -43,12 +48,12 @@ mock.module("@terreno/ui", () => {
43
48
  });
44
49
  return ReactMod.createElement(RN.View, {testID: "mock-data-table"}, rows);
45
50
  };
46
- const IconButton = ({onClick, accessibilityLabel, testID}: any) =>
51
+ const IconButton = ({onClick, accessibilityLabel, testID}: Record<string, unknown>) =>
47
52
  ReactMod.createElement(RN.Pressable, {
48
53
  onPress: onClick,
49
54
  testID: testID ?? `icon-${accessibilityLabel}`,
50
55
  });
51
- const Link = ({onClick, text, testID}: any) =>
56
+ const Link = ({onClick, text, testID}: Record<string, unknown>) =>
52
57
  ReactMod.createElement(
53
58
  RN.Pressable,
54
59
  {onPress: onClick, testID: testID ?? `link-${text}`},
@@ -63,7 +68,7 @@ mock.module("@terreno/ui", () => {
63
68
  secondaryButtonOnClick,
64
69
  onDismiss,
65
70
  title,
66
- }: any) => {
71
+ }: Record<string, unknown>) => {
67
72
  if (!visible) return null;
68
73
  return ReactMod.createElement(RN.View, {testID: `modal-${title}`}, [
69
74
  ReactMod.createElement(RN.Text, {key: "title"}, title),
@@ -101,14 +106,15 @@ mock.module("@terreno/ui", () => {
101
106
  ),
102
107
  ]);
103
108
  };
104
- const Page = ({children, title}: any) =>
109
+ const Page = ({children, title}: Record<string, unknown>) =>
105
110
  ReactMod.createElement(RN.View, {testID: "mock-page"}, [
106
111
  ReactMod.createElement(RN.Text, {key: "t"}, title),
107
112
  ...(Array.isArray(children) ? children : [children]),
108
113
  ]);
109
114
  const Spinner = () => ReactMod.createElement(RN.View, {testID: "spinner"});
110
- const Text = ({children, ...rest}: any) => ReactMod.createElement(RN.Text, rest, children);
111
- const TextField = ({value, onChange, testID, placeholder, title}: any) =>
115
+ const Text = ({children, ...rest}: Record<string, unknown>) =>
116
+ ReactMod.createElement(RN.Text, rest, children);
117
+ const TextField = ({value, onChange, testID, placeholder, title}: Record<string, unknown>) =>
112
118
  ReactMod.createElement(RN.TextInput, {
113
119
  onChangeText: onChange,
114
120
  placeholder,
@@ -130,10 +136,10 @@ mock.module("@terreno/ui", () => {
130
136
  });
131
137
 
132
138
  interface ListState {
133
- data: any;
139
+ data: unknown;
134
140
  isLoading: boolean;
135
141
  isError: boolean;
136
- error: any;
142
+ error: unknown;
137
143
  }
138
144
  const listState: ListState = {
139
145
  data: undefined,
@@ -142,21 +148,21 @@ const listState: ListState = {
142
148
  isLoading: false,
143
149
  };
144
150
  const refetchMock = mock(() => {});
145
- const uploadCalls: any[] = [];
151
+ const uploadCalls: unknown[] = [];
146
152
  const deleteCalls: string[] = [];
147
153
  const deleteFolderCalls: string[] = [];
148
- const createFolderCalls: any[] = [];
154
+ const createFolderCalls: unknown[] = [];
149
155
  const downloadCalls: string[] = [];
150
- let uploadImpl: (body: any) => Promise<any> = async () => ({});
151
- let deleteImpl: (p: string) => Promise<any> = async () => ({});
152
- let deleteFolderImpl: (p: string) => Promise<any> = async () => ({});
153
- let createFolderImpl: (body: any) => Promise<any> = async () => ({});
154
- let downloadImpl: (p: string) => Promise<any> = async () => new Blob(["hi"]);
156
+ let uploadImpl: (body: unknown) => Promise<unknown> = async () => ({});
157
+ let deleteImpl: (p: string) => Promise<unknown> = async () => ({});
158
+ let deleteFolderImpl: (p: string) => Promise<unknown> = async () => ({});
159
+ let createFolderImpl: (body: unknown) => Promise<unknown> = async () => ({});
160
+ let downloadImpl: (p: string) => Promise<unknown> = async () => new Blob(["hi"]);
155
161
 
156
162
  mock.module("../useDocumentStorageApi", () => ({
157
163
  useDocumentStorageApi: () => ({
158
164
  useCreateFolderMutation: () => [
159
- (body: any) => ({
165
+ (body: unknown) => ({
160
166
  unwrap: async () => {
161
167
  createFolderCalls.push(body);
162
168
  return createFolderImpl(body);
@@ -200,7 +206,7 @@ mock.module("../useDocumentStorageApi", () => ({
200
206
  return {...listState, refetch: refetchMock};
201
207
  },
202
208
  useUploadMutation: () => [
203
- (body: any) => ({
209
+ (body: unknown) => ({
204
210
  unwrap: async () => {
205
211
  uploadCalls.push(body);
206
212
  return uploadImpl(body);
@@ -213,7 +219,7 @@ mock.module("../useDocumentStorageApi", () => ({
213
219
 
214
220
  import {DocumentStorageBrowser} from "../DocumentStorageBrowser";
215
221
 
216
- const press = async (el: any): Promise<void> => {
222
+ const press = async (el: ReactTestInstance): Promise<void> => {
217
223
  await act(async () => {
218
224
  fireEvent.press(el);
219
225
  await new Promise((r) => setTimeout(r, 150));
@@ -243,7 +249,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
243
249
  it("creates a folder via primary button", async () => {
244
250
  listState.data = {files: [], folders: []};
245
251
  const {getByTestId} = renderWithTheme(
246
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
252
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
247
253
  );
248
254
  await press(getByTestId("document-new-folder-button"));
249
255
  const input = getByTestId("new-folder-name-input");
@@ -261,7 +267,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
261
267
  it("skips create on whitespace-only folder name", async () => {
262
268
  listState.data = {files: [], folders: []};
263
269
  const {getByTestId} = renderWithTheme(
264
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
270
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
265
271
  );
266
272
  await press(getByTestId("document-new-folder-button"));
267
273
  const input = getByTestId("new-folder-name-input");
@@ -275,7 +281,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
275
281
  it("dismisses new folder modal via secondary button", async () => {
276
282
  listState.data = {files: [], folders: []};
277
283
  const {getByTestId} = renderWithTheme(
278
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
284
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
279
285
  );
280
286
  await press(getByTestId("document-new-folder-button"));
281
287
  await press(getByTestId("modal-secondary-New Folder"));
@@ -288,7 +294,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
288
294
  throw new Error("boom");
289
295
  };
290
296
  const {getByTestId} = renderWithTheme(
291
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
297
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
292
298
  );
293
299
  await press(getByTestId("document-new-folder-button"));
294
300
  const input = getByTestId("new-folder-name-input");
@@ -302,7 +308,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
302
308
  it("navigates into a folder via DocumentNameCell Link", async () => {
303
309
  listState.data = {files: [], folders: ["sub/"]};
304
310
  const {getByTestId, queryByTestId} = renderWithTheme(
305
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
311
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
306
312
  );
307
313
  const folderLink = getByTestId("link-sub/");
308
314
  await press(folderLink);
@@ -325,7 +331,11 @@ describe("DocumentStorageBrowser (isolated)", () => {
325
331
  };
326
332
  const onFileSelect = mock(() => undefined);
327
333
  const {getByTestId} = renderWithTheme(
328
- <DocumentStorageBrowser api={{} as any} basePath="/documents" onFileSelect={onFileSelect} />
334
+ <DocumentStorageBrowser
335
+ api={{} as unknown as AdminApi}
336
+ basePath="/documents"
337
+ onFileSelect={onFileSelect}
338
+ />
329
339
  );
330
340
  await press(getByTestId("link-a.txt"));
331
341
  expect(onFileSelect).toHaveBeenCalled();
@@ -348,16 +358,16 @@ describe("DocumentStorageBrowser (isolated)", () => {
348
358
  };
349
359
  const createObjectURL = mock(() => "blob:123");
350
360
  const revokeObjectURL = mock(() => undefined);
351
- (globalThis as any).URL.createObjectURL = createObjectURL;
352
- (globalThis as any).URL.revokeObjectURL = revokeObjectURL;
361
+ (globalThis as Record<string, unknown>).URL.createObjectURL = createObjectURL;
362
+ (globalThis as Record<string, unknown>).URL.revokeObjectURL = revokeObjectURL;
353
363
  const appendChild = mock(() => undefined);
354
364
  const removeChild = mock(() => undefined);
355
- (globalThis as any).document = {
365
+ (globalThis as Record<string, unknown>).document = {
356
366
  body: {appendChild, removeChild},
357
367
  createElement: () => ({click: () => {}, download: "", href: ""}),
358
368
  };
359
369
  const {getByTestId} = renderWithTheme(
360
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
370
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
361
371
  );
362
372
  await press(getByTestId("icon-Download"));
363
373
  expect(downloadCalls.length).toBe(1);
@@ -381,7 +391,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
381
391
  folders: [],
382
392
  };
383
393
  const {getByTestId} = renderWithTheme(
384
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
394
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
385
395
  );
386
396
  await press(getByTestId("icon-Download"));
387
397
  expect(downloadCalls.length).toBe(1);
@@ -401,7 +411,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
401
411
  folders: [],
402
412
  };
403
413
  const {getByTestId} = renderWithTheme(
404
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
414
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
405
415
  );
406
416
  await press(getByTestId("icon-Delete"));
407
417
  expect(deleteCalls.length).toBe(1);
@@ -425,7 +435,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
425
435
  folders: [],
426
436
  };
427
437
  const {getByTestId} = renderWithTheme(
428
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
438
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
429
439
  );
430
440
  await press(getByTestId("icon-Delete"));
431
441
  expect(deleteCalls.length).toBe(1);
@@ -434,7 +444,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
434
444
  it("deletes a folder via folder-level IconButton", async () => {
435
445
  listState.data = {files: [], folders: ["folder1/"]};
436
446
  const {getByTestId} = renderWithTheme(
437
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
447
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
438
448
  );
439
449
  await press(getByTestId("icon-Delete folder"));
440
450
  expect(deleteFolderCalls.length).toBe(1);
@@ -447,7 +457,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
447
457
  };
448
458
  listState.data = {files: [], folders: ["folder1/"]};
449
459
  const {getByTestId} = renderWithTheme(
450
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
460
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
451
461
  );
452
462
  await press(getByTestId("icon-Delete folder"));
453
463
  expect(deleteFolderCalls.length).toBe(1);
@@ -467,7 +477,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
467
477
  folders: [],
468
478
  };
469
479
  const {toJSON} = renderWithTheme(
470
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
480
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
471
481
  );
472
482
  expect(toJSON()).toBeDefined();
473
483
  });
@@ -487,7 +497,11 @@ describe("DocumentStorageBrowser (isolated)", () => {
487
497
  folders: ["f/"],
488
498
  };
489
499
  const {queryByTestId, toJSON} = renderWithTheme(
490
- <DocumentStorageBrowser allowDelete={false} api={{} as any} basePath="/documents" />
500
+ <DocumentStorageBrowser
501
+ allowDelete={false}
502
+ api={{} as unknown as AdminApi}
503
+ basePath="/documents"
504
+ />
491
505
  );
492
506
  expect(queryByTestId("icon-Delete")).toBeNull();
493
507
  expect(queryByTestId("icon-Delete folder")).toBeNull();
@@ -497,15 +511,15 @@ describe("DocumentStorageBrowser (isolated)", () => {
497
511
  it("uploads file via hidden input onChange", async () => {
498
512
  listState.data = {files: [], folders: []};
499
513
  const {UNSAFE_root} = renderWithTheme(
500
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
514
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
501
515
  );
502
516
  const fileInputs = UNSAFE_root.findAll(
503
- (node: any) => node.type === "input" && node.props?.type === "file"
517
+ (node: ReactTestInstance) => node.type === "input" && node.props?.type === "file"
504
518
  );
505
519
  expect(fileInputs.length).toBe(1);
506
520
  const fakeFile = new File(["x"], "x.txt", {type: "text/plain"});
507
521
  await act(async () => {
508
- (fileInputs[0] as any).props.onChange({
522
+ (fileInputs[0] as ReactTestInstance).props.onChange({
509
523
  target: {files: [fakeFile], value: ""},
510
524
  });
511
525
  await new Promise((r) => setTimeout(r, 30));
@@ -519,14 +533,14 @@ describe("DocumentStorageBrowser (isolated)", () => {
519
533
  };
520
534
  listState.data = {files: [], folders: []};
521
535
  const {UNSAFE_root} = renderWithTheme(
522
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
536
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
523
537
  );
524
538
  const fileInputs = UNSAFE_root.findAll(
525
- (node: any) => node.type === "input" && node.props?.type === "file"
539
+ (node: ReactTestInstance) => node.type === "input" && node.props?.type === "file"
526
540
  );
527
541
  const fakeFile = new File(["x"], "x.txt", {type: "text/plain"});
528
542
  await act(async () => {
529
- (fileInputs[0] as any).props.onChange({
543
+ (fileInputs[0] as ReactTestInstance).props.onChange({
530
544
  target: {files: [fakeFile], value: ""},
531
545
  });
532
546
  await new Promise((r) => setTimeout(r, 30));
@@ -537,13 +551,13 @@ describe("DocumentStorageBrowser (isolated)", () => {
537
551
  it("ignores upload when no file selected", async () => {
538
552
  listState.data = {files: [], folders: []};
539
553
  const {UNSAFE_root} = renderWithTheme(
540
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
554
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
541
555
  );
542
556
  const fileInputs = UNSAFE_root.findAll(
543
- (node: any) => node.type === "input" && node.props?.type === "file"
557
+ (node: ReactTestInstance) => node.type === "input" && node.props?.type === "file"
544
558
  );
545
559
  await act(async () => {
546
- (fileInputs[0] as any).props.onChange({target: {files: []}});
560
+ (fileInputs[0] as ReactTestInstance).props.onChange({target: {files: []}});
547
561
  await new Promise((r) => setTimeout(r, 10));
548
562
  });
549
563
  expect(uploadCalls.length).toBe(0);
@@ -552,7 +566,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
552
566
  it("renders breadcrumb links after navigating into a folder", async () => {
553
567
  listState.data = {files: [], folders: ["dir-a/"]};
554
568
  const {getByTestId, queryByTestId} = renderWithTheme(
555
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
569
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
556
570
  );
557
571
  await press(getByTestId("link-dir-a/"));
558
572
  // Back to Root: breadcrumb should include Root link
@@ -569,7 +583,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
569
583
  const onSettingsPress = mock(() => undefined);
570
584
  const {getByText} = renderWithTheme(
571
585
  <DocumentStorageBrowser
572
- api={{} as any}
586
+ api={{} as unknown as AdminApi}
573
587
  basePath="/documents"
574
588
  onSettingsPress={onSettingsPress}
575
589
  />
@@ -581,7 +595,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
581
595
  it("refetches via refresh button when data is loaded", async () => {
582
596
  listState.data = {files: [], folders: []};
583
597
  const {getByTestId} = renderWithTheme(
584
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
598
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
585
599
  );
586
600
  await press(getByTestId("document-refresh-button"));
587
601
  expect(refetchMock).toHaveBeenCalled();
@@ -591,7 +605,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
591
605
  listState.isError = true;
592
606
  listState.error = {status: 503};
593
607
  const {getByTestId} = renderWithTheme(
594
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
608
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
595
609
  );
596
610
  await act(async () => {
597
611
  await new Promise((r) => setTimeout(r, 30));
@@ -606,7 +620,7 @@ describe("DocumentStorageBrowser (isolated)", () => {
606
620
  const onSettingsPress = mock(() => undefined);
607
621
  const {getByText} = renderWithTheme(
608
622
  <DocumentStorageBrowser
609
- api={{} as any}
623
+ api={{} as unknown as AdminApi}
610
624
  basePath="/documents"
611
625
  onSettingsPress={onSettingsPress}
612
626
  />
@@ -619,16 +633,16 @@ describe("DocumentStorageBrowser (isolated)", () => {
619
633
  listState.data = {files: [], folders: []};
620
634
  const clickMock = mock(() => undefined);
621
635
  const {UNSAFE_root, getByTestId} = renderWithTheme(
622
- <DocumentStorageBrowser api={{} as any} basePath="/documents" />
636
+ <DocumentStorageBrowser api={{} as unknown as AdminApi} basePath="/documents" />
623
637
  );
624
638
  // Locate the hidden file input and inject a click spy to verify the
625
639
  // button's handler reaches the underlying DOM ref.
626
640
  const fileInputs = UNSAFE_root.findAll(
627
- (node: any) => node.type === "input" && node.props?.type === "file"
641
+ (node: ReactTestInstance) => node.type === "input" && node.props?.type === "file"
628
642
  );
629
643
  expect(fileInputs.length).toBe(1);
630
644
  // Manually override instance.click since the test renderer doesn't execute DOM methods.
631
- const instance = fileInputs[0] as any;
645
+ const instance = fileInputs[0] as ReactTestInstance & {instance?: {click: () => void}};
632
646
  if (instance.instance) {
633
647
  instance.instance.click = clickMock;
634
648
  }
@@ -642,8 +656,8 @@ describe("DocumentStorageBrowser (isolated)", () => {
642
656
  downloadImpl = async () => blob;
643
657
  const createObjectURL = mock(() => "blob:img-123");
644
658
  const revokeObjectURL = mock(() => undefined);
645
- (globalThis as any).URL.createObjectURL = createObjectURL;
646
- (globalThis as any).URL.revokeObjectURL = revokeObjectURL;
659
+ (globalThis as Record<string, unknown>).URL.createObjectURL = createObjectURL;
660
+ (globalThis as Record<string, unknown>).URL.revokeObjectURL = revokeObjectURL;
647
661
  listState.data = {
648
662
  files: [
649
663
  {
@@ -661,10 +675,10 @@ describe("DocumentStorageBrowser (isolated)", () => {
661
675
  // commented out), so we reach through the ActionsCell to find a node
662
676
  // whose onClick navigates to handleViewFile. If not found, invoke
663
677
  // handleViewFile by seeking props that match the pattern.
664
- const captured: any[] = [];
678
+ const captured: unknown[] = [];
665
679
  const {UNSAFE_root, unmount} = renderWithTheme(
666
680
  <DocumentStorageBrowser
667
- api={{} as any}
681
+ api={{} as unknown as AdminApi}
668
682
  basePath="/documents"
669
683
  onFileSelect={(file) => {
670
684
  captured.push(file);
@@ -672,7 +686,9 @@ describe("DocumentStorageBrowser (isolated)", () => {
672
686
  />
673
687
  );
674
688
  // Use the fact that onFileSelect is provided → Link wrapper exists.
675
- const fileLink = UNSAFE_root.findAll((n: any) => n.props?.testID === "link-img.png");
689
+ const fileLink = UNSAFE_root.findAll(
690
+ (n: ReactTestInstance) => n.props?.testID === "link-img.png"
691
+ );
676
692
  expect(fileLink.length).toBeGreaterThan(0);
677
693
  await press(fileLink[0]);
678
694
  expect(captured.length).toBe(1);