1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-06-08 18:20:20 +00:00

test(sasjs): prepend services/ to paths

This commit is contained in:
mulahasanovic
2026-05-05 14:49:23 +02:00
parent a38548d8de
commit 31b3959e2c
5 changed files with 64 additions and 41 deletions
+11 -3
View File
@@ -77,7 +77,7 @@ export const basicTests = (
await adapter.logOut()
return await adapter.request(
'common/sendArr',
'services/common/sendArr',
stringData,
undefined,
async () => {
@@ -97,7 +97,11 @@ export const basicTests = (
useComputeApi: false
}
return await adapter.request('common/sendArr', stringData, config)
return await adapter.request(
'services/common/sendArr',
stringData,
config
)
},
assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1
@@ -112,7 +116,11 @@ export const basicTests = (
debug: true
}
return await adapter.request('common/sendArr', stringData, config)
return await adapter.request(
'services/common/sendArr',
stringData,
config
)
},
assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1
+5 -1
View File
@@ -22,7 +22,11 @@ export const fileUploadTests = (adapter: SASjs): TestSuite => ({
}
]
return adapter.uploadFile('common/sendMacVars', filesToUpload, null)
return adapter.uploadFile(
'services/common/sendMacVars',
filesToUpload,
null
)
},
assertion: (response: any) =>
(response.macvars as any[]).findIndex(
+29 -21
View File
@@ -53,7 +53,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Absolute paths',
description: 'Should work with absolute paths to SAS jobs',
test: () => {
return adapter.request(`${appLoc}/common/sendArr`, stringData)
return adapter.request(`${appLoc}/services/common/sendArr`, stringData)
},
assertion: (res: any) => {
return res.table1[0][0] === stringData.table1[0].col1
@@ -63,7 +63,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Single string value',
description: 'Should send an array with a single string value',
test: () => {
return adapter.request('common/sendArr', stringData)
return adapter.request('services/common/sendArr', stringData)
},
assertion: (res: any) => {
return res.table1[0][0] === stringData.table1[0].col1
@@ -74,7 +74,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
description:
'Should send an array with a long string value under 32765 characters',
test: () => {
return adapter.request('common/sendArr', getLongStringData())
return adapter.request('services/common/sendArr', getLongStringData())
},
assertion: (res: any) => {
const longStringData = getLongStringData()
@@ -87,7 +87,9 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
'Should error out with long string values over 32765 characters',
test: () => {
const data = getLongStringData(32767)
return adapter.request('common/sendArr', data).catch((e: any) => e)
return adapter
.request('services/common/sendArr', data)
.catch((e: any) => e)
},
assertion: (error: any) => {
return !!error && !!error.error && !!error.error.message
@@ -97,7 +99,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Single numeric value',
description: 'Should send an array with a single numeric value',
test: () => {
return adapter.request('common/sendArr', numericData)
return adapter.request('services/common/sendArr', numericData)
},
assertion: (res: any) => {
return res.table1[0][0] === numericData.table1[0].col1
@@ -107,7 +109,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Multiple columns',
description: 'Should handle data with multiple columns',
test: () => {
return adapter.request('common/sendArr', multiColumnData)
return adapter.request('services/common/sendArr', multiColumnData)
},
assertion: (res: any) => {
return (
@@ -122,7 +124,7 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Multiple rows with nulls',
description: 'Should handle data with multiple rows with null values',
test: () => {
return adapter.request('common/sendArr', multipleRowsWithNulls)
return adapter.request('services/common/sendArr', multipleRowsWithNulls)
},
assertion: (res: any) => {
let result = true
@@ -148,7 +150,10 @@ export const sendArrTests = (adapter: SASjs, appLoc: string): TestSuite => ({
title: 'Multiple columns with nulls',
description: 'Should handle data with multiple columns with null values',
test: () => {
return adapter.request('common/sendArr', multipleColumnsWithNulls)
return adapter.request(
'services/common/sendArr',
multipleColumnsWithNulls
)
},
assertion: (res: any) => {
let result = true
@@ -184,7 +189,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
'1InvalidTable': [{ col1: 42 }]
}
return adapter
.request('common/sendObj', invalidData)
.request('services/common/sendObj', invalidData)
.catch((e: any) => e)
},
assertion: (error: any) =>
@@ -198,7 +203,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
'an invalidTable': [{ col1: 42 }]
}
return adapter
.request('common/sendObj', invalidData)
.request('services/common/sendObj', invalidData)
.catch((e: any) => e)
},
assertion: (error: any) =>
@@ -212,7 +217,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
'anInvalidTable#': [{ col1: 42 }]
}
return adapter
.request('common/sendObj', invalidData)
.request('services/common/sendObj', invalidData)
.catch((e: any) => e)
},
assertion: (error: any) =>
@@ -227,7 +232,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
}
return adapter
.request('common/sendObj', invalidData)
.request('services/common/sendObj', invalidData)
.catch((e: any) => e)
},
assertion: (error: any) =>
@@ -241,7 +246,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
inData: [[{ data: 'value' }]]
}
return adapter
.request('common/sendObj', invalidData)
.request('services/common/sendObj', invalidData)
.catch((e: any) => e)
},
assertion: (error: any) =>
@@ -251,7 +256,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Single string value',
description: 'Should send an object with a single string value',
test: () => {
return adapter.request('common/sendObj', stringData)
return adapter.request('services/common/sendObj', stringData)
},
assertion: (res: any) => {
return res.table1[0].COL1 === stringData.table1[0].col1
@@ -262,7 +267,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
description:
'Should send an object with a long string value under 32765 characters',
test: () => {
return adapter.request('common/sendObj', getLongStringData())
return adapter.request('services/common/sendObj', getLongStringData())
},
assertion: (res: any) => {
const longStringData = getLongStringData()
@@ -275,7 +280,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
'Should error out with long string values over 32765 characters',
test: () => {
return adapter
.request('common/sendObj', getLongStringData(32767))
.request('services/common/sendObj', getLongStringData(32767))
.catch((e: any) => e)
},
assertion: (error: any) => {
@@ -286,7 +291,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Single numeric value',
description: 'Should send an object with a single numeric value',
test: () => {
return adapter.request('common/sendObj', numericData)
return adapter.request('services/common/sendObj', numericData)
},
assertion: (res: any) => {
return res.table1[0].COL1 === numericData.table1[0].col1
@@ -297,7 +302,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Large data volume',
description: 'Should send an object with a large amount of data',
test: () => {
return adapter.request('common/sendObj', getLargeObjectData())
return adapter.request('services/common/sendObj', getLargeObjectData())
},
assertion: (res: any) => {
const data = getLargeObjectData()
@@ -308,7 +313,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Multiple columns',
description: 'Should handle data with multiple columns',
test: () => {
return adapter.request('common/sendObj', multiColumnData)
return adapter.request('services/common/sendObj', multiColumnData)
},
assertion: (res: any) => {
return (
@@ -323,7 +328,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Multiple rows with nulls',
description: 'Should handle data with multiple rows with null values',
test: () => {
return adapter.request('common/sendObj', multipleRowsWithNulls)
return adapter.request('services/common/sendObj', multipleRowsWithNulls)
},
assertion: (res: any) => {
let result = true
@@ -349,7 +354,10 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
title: 'Multiple columns with nulls',
description: 'Should handle data with multiple columns with null values',
test: () => {
return adapter.request('common/sendObj', multipleColumnsWithNulls)
return adapter.request(
'services/common/sendObj',
multipleColumnsWithNulls
)
},
assertion: (res: any) => {
let result = true
+2 -2
View File
@@ -11,7 +11,7 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
title: 'WORK tables',
description: 'Should get WORK tables after request',
test: async () => {
return adapter.request('common/sendArr', data)
return adapter.request('services/common/sendArr', data)
},
assertion: () => {
const requests = adapter.getSasRequests()
@@ -28,7 +28,7 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
// 'Should make an error and capture log, in the same time it is testing if debug override is working',
// test: async () => {
// return adapter
// .request('common/makeErr', data, { debug: true })
// .request('services/common/makeErr', data, { debug: true })
// .catch(() => {
// const sasRequests = adapter.getSasRequests()
// const makeErrRequest: any =
+17 -14
View File
@@ -111,7 +111,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Common special characters',
description: 'Should handle common special characters',
test: () => {
return adapter.request('common/sendArr', specialCharData)
return adapter.request('services/common/sendArr', specialCharData)
},
assertion: (res: any) => {
return (
@@ -133,7 +133,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Other special characters',
description: 'Should handle other special characters',
test: () => {
return adapter.request('common/sendArr', moreSpecialCharData)
return adapter.request('services/common/sendArr', moreSpecialCharData)
},
assertion: (res: any) => {
// If sas session is `latin9` or `wlatin1` we can't process the special characters,
@@ -169,7 +169,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Wide table with sendArr',
description: 'Should handle data with 10000 columns',
test: () => {
return adapter.request('common/sendArr', getWideData())
return adapter.request('services/common/sendArr', getWideData())
},
assertion: (res: any) => {
const data = getWideData()
@@ -185,7 +185,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Wide table with sendObj',
description: 'Should handle data with 10000 columns',
test: () => {
return adapter.request('common/sendObj', getWideData())
return adapter.request('services/common/sendObj', getWideData())
},
assertion: (res: any) => {
const data = getWideData()
@@ -202,7 +202,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Multiple tables',
description: 'Should handle data with 100 tables',
test: () => {
return adapter.request('common/sendArr', getTables())
return adapter.request('services/common/sendArr', getTables())
},
assertion: (res: any) => {
const data = getTables()
@@ -222,7 +222,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Large dataset with sendObj',
description: 'Should handle 5mb of data',
test: () => {
return adapter.request('common/sendObj', getLargeDataset())
return adapter.request('services/common/sendObj', getLargeDataset())
},
assertion: (res: any) => {
const data = getLargeDataset()
@@ -237,7 +237,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Large dataset with sendArr',
description: 'Should handle 5mb of data',
test: () => {
return adapter.request('common/sendArr', getLargeDataset())
return adapter.request('services/common/sendArr', getLargeDataset())
},
assertion: (res: any) => {
const data = getLargeDataset()
@@ -253,7 +253,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Error and _csrf tables with sendArr',
description: 'Should handle error and _csrf tables',
test: () => {
return adapter.request('common/sendArr', errorAndCsrfData)
return adapter.request('services/common/sendArr', errorAndCsrfData)
},
assertion: (res: any) => {
return (
@@ -272,7 +272,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Error and _csrf tables with sendObj',
description: 'Should handle error and _csrf tables',
test: () => {
return adapter.request('common/sendObj', errorAndCsrfData)
return adapter.request('services/common/sendObj', errorAndCsrfData)
},
assertion: (res: any) => {
return (
@@ -300,7 +300,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
}
return await adapter.request(
'common/sendArr',
'services/common/sendArr',
stringData,
config,
undefined,
@@ -319,7 +319,10 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
title: 'Special missing values',
description: 'Should support special missing values',
test: () => {
return adapter.request('common/sendObj', testTableWithSpecialNumeric)
return adapter.request(
'services/common/sendObj',
testTableWithSpecialNumeric
)
},
assertion: (res: any) => {
let assertionRes = true
@@ -365,7 +368,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
'Should support special missing values, when one row is send',
test: () => {
return adapter.request(
'common/sendObj',
'services/common/sendObj',
testTableWithSpecialNumericOneRow
)
},
@@ -413,7 +416,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
'Should support special missing values, when LOWERCASE value is sent',
test: () => {
return adapter.request(
'common/sendObj',
'services/common/sendObj',
testTableWithSpecialNumericLowercase
)
},
@@ -469,7 +472,7 @@ export const specialCaseTests = (adapter: SASjs): TestSuite => ({
'Should support special missing values, when one row is send (On VIYA Web Approach)',
test: () => {
return adapter.request(
'common/sendObj',
'services/common/sendObj',
testTableWithSpecialNumericOneRow,
{ useComputeApi: undefined }
)