mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-11 01:14:36 +00:00
chore: fix specs for getFormData and convertToCsv
This commit is contained in:
@@ -10,10 +10,14 @@ export const convertToCSV = (
|
|||||||
tableName: string
|
tableName: string
|
||||||
) => {
|
) => {
|
||||||
if (!data[tableName]) {
|
if (!data[tableName]) {
|
||||||
throw prefixMessage(
|
const error = prefixMessage(
|
||||||
'No table provided to be converted to CSV.',
|
'No table provided to be converted to CSV.',
|
||||||
'Error while converting to CSV. '
|
'Error while converting to CSV. '
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (typeof error === 'string') throw new Error(error)
|
||||||
|
|
||||||
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
const table = data[tableName]
|
const table = data[tableName]
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ describe('getFormData', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should return FormData if environment is not Node', () => {
|
it('should return FormData if environment is not Node', () => {
|
||||||
const formDataMock = () => {}
|
// Ensure FormData is globally available
|
||||||
;(global as any).FormData = formDataMock
|
;(global as any).FormData = class FormData {}
|
||||||
|
|
||||||
jest.spyOn(isNodeModule, 'isNode').mockImplementation(() => false)
|
jest.spyOn(isNodeModule, 'isNode').mockImplementation(() => false)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user