Skip to content

Commit

Permalink
Fix a bunch of FileUploader js unit tests (#7019)
Browse files Browse the repository at this point in the history
* Fix a bunch of FileUploader js unit tests

* Fix a bunch of type errors in tests
  • Loading branch information
vdonato committed Jul 18, 2023
1 parent 6a25b9e commit 4430df9
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 122 deletions.
4 changes: 4 additions & 0 deletions frontend/lib/src/FileUploadClient.test.ts
Expand Up @@ -141,6 +141,8 @@ describe("FileUploadClient Upload", () => {
})

it("onFileURLsResponse rejects promise on errorMsg", () => {
const fileURLsPromise = uploader.fetchFileURLs([])

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable fileURLsPromise.

// @ts-expect-error
const pendingReqs = uploader.pendingFileURLsRequests
const reqId = pendingReqs.keys().next().value
Expand All @@ -155,6 +157,8 @@ describe("FileUploadClient Upload", () => {
})

it("onFileURLsResponse resolves promise on success", () => {
const fileURLsPromise = uploader.fetchFileURLs([])

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable fileURLsPromise.

// @ts-expect-error
const pendingReqs = uploader.pendingFileURLsRequests
const reqId = pendingReqs.keys().next().value
Expand Down
Expand Up @@ -87,7 +87,6 @@ describe("CameraInput widget", () => {
const wrapper = shallow(<CameraInput {...props} />)
expect(wrapper.state()).toEqual({
files: [],
newestServerFileId: 0,
clearPhotoInProgress: false,
facingMode: FacingMode.USER,
imgSrc: null,
Expand Down Expand Up @@ -198,7 +197,6 @@ describe("CameraInput widget", () => {
await wrapper.instance().removeCapture()
expect(wrapper.state()).toEqual({
files: [],
newestServerFileId: 1,
clearPhotoInProgress: true,
facingMode: FacingMode.USER,
imgSrc: null,
Expand Down

0 comments on commit 4430df9

Please sign in to comment.