1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

chore: Merge branch 'special-missings' of https://github.com/sasjs/adapter into special-missings

This commit is contained in:
Yury Shkoda
2022-03-03 15:13:58 +03:00
2 changed files with 52 additions and 3 deletions

View File

@@ -2388,7 +2388,7 @@
"node_modules/@sasjs/adapter": {
"version": "5.0.0",
"resolved": "file:../build/sasjs-adapter-5.0.0.tgz",
"integrity": "sha512-JZsvovkPNb0dlnBRh1uDdvgJg+BE0ebIomWwhYjHj3YApds4MgI++1pa+Ck2tltIUUYASeiPUIPJJX8tF3VCTw==",
"integrity": "sha512-O4MnLA6Tm2xoANU1uBJ5xMzEBeXVGkw38lR6LoiLIUhQOJY5gpwjb39oBPFqPfvCwjG0Jqjx7XcaE+g23pEfNw==",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {
@@ -20998,7 +20998,7 @@
},
"@sasjs/adapter": {
"version": "file:../build/sasjs-adapter-5.0.0.tgz",
"integrity": "sha512-JZsvovkPNb0dlnBRh1uDdvgJg+BE0ebIomWwhYjHj3YApds4MgI++1pa+Ck2tltIUUYASeiPUIPJJX8tF3VCTw==",
"integrity": "sha512-O4MnLA6Tm2xoANU1uBJ5xMzEBeXVGkw38lR6LoiLIUhQOJY5gpwjb39oBPFqPfvCwjG0Jqjx7XcaE+g23pEfNw==",
"requires": {
"@sasjs/utils": "2.36.1",
"axios": "0.26.0",

View File

@@ -416,6 +416,55 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
return assertionRes
}
}
},
{
title: 'Special missing values (ONE ROW) useComputeApi undefined',
description:
'Should support special missing values, when one row is send (On VIYA Web Approach)',
test: () => {
return adapter.request(
'common/sendObj',
testTableWithSpecialNumericOneRow,
{ useComputeApi: undefined }
)
},
assertion: (res: any) => {
let assertionRes = true
// We receive formats in response. We compare it with formats that we included in request to make sure they are equal
const resVars = res[`$${testTable}`].vars
Object.keys(resVars).forEach((key: any, i: number) => {
let formatValue =
testTableWithSpecialNumeric[`$${testTable}`].formats[
key.toLowerCase()
]
// If it is char, we change it to $ to be compatible for comparsion
// If it is number, it will already be compatible to comapre (best.)
formatValue = formatValue?.includes('$') ? '$' : formatValue
if (
formatValue !== undefined &&
!resVars[key].format.includes(formatValue)
) {
assertionRes = false
}
})
// Here we will compare the response values with values we send
const resValues = res[testTable]
testTableWithSpecialNumericOneRow[testTable].forEach(
(row: { [key: string]: any }, i: number) =>
Object.keys(row).forEach((col: string) => {
if (resValues[i][col.toUpperCase()] !== row[col]) {
assertionRes = false
}
})
)
return assertionRes
}
},
]
})