1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-07 12:30:06 +00:00

chore: better test coverage

This commit is contained in:
2025-03-04 14:48:22 +01:00
parent 18be9e8806
commit b3b2c1414c
5 changed files with 487 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { parseSasViyaLog } from '../parseSasViyaLog'
describe('parseSasViyaLog', () => {
it('should parse sas viya log if environment is Node', () => {
const logResponse = {
items: [{ line: 'Line 1' }, { line: 'Line 2' }, { line: 'Line 3' }]
}
const expectedLog = 'Line 1\nLine 2\nLine 3'
const result = parseSasViyaLog(logResponse)
expect(result).toEqual(expectedLog)
})
it('should handle exceptions and return the original logResponse', () => {
// Create a logResponse that will cause an error in the mapping process.
const logResponse: any = {
items: null
}
// Since logResponse.items is null, the ternary operator returns the else branch.
const expectedLog = JSON.stringify(logResponse)
const result = parseSasViyaLog(logResponse)
expect(result).toEqual(expectedLog)
})
})