From a34f951ac5a9fb17fefe53023962ab2c396e4fcb Mon Sep 17 00:00:00 2001 From: Jackson Howe Date: Tue, 25 Jul 2023 15:14:48 -0600 Subject: [PATCH] Provide missing props to RceFileBrowser specs Also tweaks some proptypes for RceFileBrowser: - refreshToken is actually a function used by RceApiSource; its not required as there's a default in RceApiSource - source is actually an instance of RceApiSource and is not required as one is created in RceFileBrowser if undefined refs LF-535 flag = none Test plan: specs pass Change-Id: Iae27ce90384ba4a74ae55ef0aa444880056d5d46 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323574 Reviewed-by: Mysti Lilla QA-Review: Jackson Howe Product-Review: Jackson Howe Tested-by: Service Cloud Jenkins --- packages/canvas-rce/jest/jest-setup.js | 6 ------ .../src/rce/plugins/shared/RceFileBrowser.js | 4 ++-- .../plugins/shared/__tests__/RceFileBrowser.test.js | 11 +++++++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/canvas-rce/jest/jest-setup.js b/packages/canvas-rce/jest/jest-setup.js index abaf6344414..16b8629ecb0 100644 --- a/packages/canvas-rce/jest/jest-setup.js +++ b/packages/canvas-rce/jest/jest-setup.js @@ -41,14 +41,12 @@ const ignoredErrors = [ /The prop `sortBy.order` is marked as required in `DocumentsPanel`/, /The prop `sortBy.order` is marked as required in `SavedIconMakerList`/, /Invalid prop `images.searchString` of type `string` supplied to `SavedIconMakerList`/, - /The prop `refreshToken` is marked as required in `RceFileBrowser`/, /Invalid prop `media.searchString` of type `string` supplied to `MediaPanel`/, /Can't call %s on a component that is not yet mounted./, /The prop `dimensionsState.usePercentageUnits` is marked as required in `DimensionsInput`/, /The prop `videoOptions.naturalHeight` is marked as required in `VideoOptionsTray`/, /The prop `sortBy.order` is marked as required in `MediaPanel`/, /Invalid prop `images.searchString` of type `string` supplied to `Images`/, - /Invalid prop `source` of type `object` supplied to `RceFileBrowser`/, /unknown pseudo-class selector'/, /Invalid URL: undefined/, /failed updating video captions/, @@ -56,9 +54,6 @@ const ignoredErrors = [ /The prop `state.image` is marked as required in `ImageOptions`/, /The prop `data.icon` is marked as required in `SingleColor`/, /The content `content` is marked as required in `LinkOptionsTray`/, - /The prop `host` is marked as required in `RceFileBrowser`/, - /The prop `jwt` is marked as required in `RceFileBrowser`/, - /The prop `source` is marked as required in `RceFileBrowser`/, /The prop `contextType` is marked as required in `DocumentsPanel`/, /The prop `media.course.files\[0].title` is marked as required in `MediaPanel`/, /The prop `contextType` is marked as required in `MediaPanel`/, @@ -66,7 +61,6 @@ const ignoredErrors = [ /The prop `audioOptions.id` is marked as required in `AudioOptionsTray`/, /The prop `trayProps` is marked as required in `AudioOptionsTray`/, /Invalid prop `audioOptions` of type `boolean` supplied to `AudioOptionsTray`/, - /The prop `context` is marked as required in `RceFileBrowser`/, /Invalid prop `audioOptions` of type `boolean` supplied to `AudioOptionsTray`/, /Not implemented: navigation/, /Not implemented: HTMLFormElement.prototype.submit/, diff --git a/packages/canvas-rce/src/rce/plugins/shared/RceFileBrowser.js b/packages/canvas-rce/src/rce/plugins/shared/RceFileBrowser.js index d594a41aafd..08f9e4dff0e 100644 --- a/packages/canvas-rce/src/rce/plugins/shared/RceFileBrowser.js +++ b/packages/canvas-rce/src/rce/plugins/shared/RceFileBrowser.js @@ -35,9 +35,9 @@ RceFileBrowser.propTypes = { searchString: string.isRequired, canvasOrigin: string, jwt: string.isRequired, - refreshToken: string.isRequired, + refreshToken: func, host: string.isRequired, - source: string.isRequired, + source: object, context: object.isRequired, } diff --git a/packages/canvas-rce/src/rce/plugins/shared/__tests__/RceFileBrowser.test.js b/packages/canvas-rce/src/rce/plugins/shared/__tests__/RceFileBrowser.test.js index 17b45088a35..f1d7856ef8f 100644 --- a/packages/canvas-rce/src/rce/plugins/shared/__tests__/RceFileBrowser.test.js +++ b/packages/canvas-rce/src/rce/plugins/shared/__tests__/RceFileBrowser.test.js @@ -26,9 +26,16 @@ jest.mock('../../../../canvasFileBrowser/FileBrowser', () => { }) jest.mock('../../../../bridge') +const onAllFilesLoading = jest.fn() +const props = { + searchString: '', + onAllFilesLoading, + host: 'canvas.docker', + jwt: 'fakejwt', + context: {type: 'course', id: '1'}, +} + describe('RceFileBrowser', () => { - const onAllFilesLoading = jest.fn() - const props = {searchString: '', onAllFilesLoading} afterEach(() => FileBrowser.mockClear()) it('invokes onFileSelect callback with appropriate data when a file is selected', () => {