Skip to content

Commit 967559a

Browse files
authored
fix(StorageBrowser): update createEnhancedListHandler interfaces (#6533)
1 parent 8e7a733 commit 967559a

File tree

12 files changed

+295
-411
lines changed

12 files changed

+295
-411
lines changed

.changeset/empty-cobras-obey.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@aws-amplify/ui-react-storage": patch
3+
---
4+
5+
fix(StorageBrowser): update createEnhancedListHandler interfaces

packages/react-storage/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"name": "createStorageBrowser",
6767
"path": "dist/esm/browser.mjs",
6868
"import": "{ createStorageBrowser }",
69-
"limit": "64.19 kB",
69+
"limit": "64.5 kB",
7070
"ignore": [
7171
"@aws-amplify/storage"
7272
]
@@ -75,7 +75,7 @@
7575
"name": "StorageBrowser",
7676
"path": "dist/esm/index.mjs",
7777
"import": "{ StorageBrowser }",
78-
"limit": "86.74 kB"
78+
"limit": "87 kB"
7979
},
8080
{
8181
"name": "FileUploader",

packages/react-storage/src/components/StorageBrowser/useAction/__tests__/createEnhancedListHandler.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type Handler = ListHandler<ListHandlerInput, Output>;
2020

2121
describe('createEnhancedListHandler', () => {
2222
beforeEach(() => {
23-
jest.clearAllMocks();
23+
jest.resetAllMocks();
2424
});
2525

2626
it('should return an empty state when reset is true', async () => {
@@ -95,7 +95,7 @@ describe('createEnhancedListHandler', () => {
9595
{ name: 'date' },
9696
]);
9797
expect(result.nextToken).toBeUndefined();
98-
expect(result.search?.hasExhaustedSearch).toBeFalsy();
98+
expect(result.hasExhaustedSearch).toBeFalsy();
9999
});
100100

101101
it('should collect and filter results using a filter key function', async () => {
@@ -124,7 +124,7 @@ describe('createEnhancedListHandler', () => {
124124
options: {
125125
search: {
126126
query: 'a',
127-
filterBy: (item) => {
127+
filterBy: (item: Record<'alt' | 'name', any>) => {
128128
return item.alt ? 'alt' : 'name';
129129
},
130130
},
@@ -139,7 +139,7 @@ describe('createEnhancedListHandler', () => {
139139
]);
140140

141141
expect(result.nextToken).toBeUndefined();
142-
expect(result.search?.hasExhaustedSearch).toBeFalsy();
142+
expect(result.hasExhaustedSearch).toBeFalsy();
143143
});
144144

145145
it('should collect and filter results when search and duplicate prefix is provided', async () => {
@@ -190,9 +190,7 @@ describe('createEnhancedListHandler', () => {
190190
expect(mockAction).toHaveBeenCalledTimes(2);
191191
expect(result.items.length).toBe(SEARCH_LIMIT);
192192
expect(result.nextToken).toBeUndefined();
193-
expect(result.search?.hasExhaustedSearch).toBeTruthy();
194-
195-
mockAction.mockReset();
193+
expect(result.hasExhaustedSearch).toBe(true);
196194
});
197195

198196
it('should ignore provided nextToken on refresh', async () => {

0 commit comments

Comments
 (0)