mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-06 20:10:05 +00:00
fix(convert-to-csv): return empty string if table is not an array
This commit is contained in:
@@ -219,4 +219,10 @@ describe('convertToCsv', () => {
|
||||
new Error('No table provided to be converted to CSV')
|
||||
)
|
||||
})
|
||||
|
||||
it('should empty string if table is not an array', () => {
|
||||
const data = { [tableName]: true }
|
||||
|
||||
expect(convertToCSV(data, tableName)).toEqual('')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -11,6 +11,9 @@ export const convertToCSV = (
|
||||
}
|
||||
|
||||
const table = data[tableName]
|
||||
|
||||
if (!Array.isArray(table)) return ''
|
||||
|
||||
let formats = data[`$${tableName}`]?.formats
|
||||
let headers: string[] = []
|
||||
let csvTest
|
||||
|
||||
Reference in New Issue
Block a user