Skip to content

Commit

Permalink
✅ fixes test
Browse files Browse the repository at this point in the history
  • Loading branch information
josemigallas committed Apr 13, 2023
1 parent 44a5be5 commit 4b6c286
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions spec/javascripts/ActiveDocs/ThreeScaleApiDocs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { objectToFormData, transformReportRequestBody } from 'ActiveDocs/ThreeScaleApiDocs'

import type { BackendApiReportBody, BackendApiTransaction, BodyValue } from 'Types/SwaggerTypes'
import type { BackendApiReportBody, BackendApiTransaction, BodyValue, BodyValueObject } from 'Types/SwaggerTypes'

const transaction1: BackendApiTransaction = {
app_id: 'app-id1',
Expand Down Expand Up @@ -75,12 +75,15 @@ describe('objectToFormData', () => {
})

it('returns an empty object if argument is not a valid object', () => {
expect(objectToFormData('hello')).toEqual({})
expect(objectToFormData(true)).toEqual({})
expect(objectToFormData(123)).toEqual({})
expect(objectToFormData(['q', 'w', 'r'])).toEqual({})
})
const invalidObjects = [
'hello',
true,
123,
['q', 'w', 'r']
] as unknown as BodyValueObject[]

invalidObjects.forEach(i => { expect(objectToFormData(i)).toEqual({}) })
})
})

describe('transformReportRequestBody', () => {
Expand Down
1 change: 1 addition & 0 deletions spec/javascripts/__mocks__/swagger-ui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = jest.fn()

0 comments on commit 4b6c286

Please sign in to comment.