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