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

test(viya): migrate execution-tasks tests to runAsTask config

This commit is contained in:
mulahasanovic
2026-05-12 20:10:58 +02:00
parent 3136e98477
commit eb6b123dba
2 changed files with 159 additions and 56 deletions
+87 -22
View File
@@ -4,55 +4,120 @@ import type { TestSuite } from '../types'
const tableData: any = { table1: [{ col1: 'first col value' }] }
const fileData: any = { table1: [{ col1: 'value with ; semicolon' }] }
const multiTableData: any = {
table1: [{ col1: 'first col value' }],
table2: [{ col2: 'second table value' }]
}
const multiFileData: any = {
table1: [{ col1: 'value with ; semicolon' }],
table2: [{ col2: 'another; value' }]
}
const taskConfig: any = { useComputeApi: null, runAsTask: true }
const noTaskConfig: any = { useComputeApi: null, runAsTask: false }
export const executionTasksTests = (adapter: SASjs): TestSuite => ({
name: '_executionTasks=true behaviour',
name: 'runAsTask behaviour',
tests: [
{
title: 'sends table data in body',
description: 'table payload, no _executionTasks flag',
title: 'no inputs (runAsTask=false)',
description: 'no payload, runAsTask explicitly disabled',
test: () =>
adapter
.request('services/common/sendArr', tableData, {
useComputeApi: null
})
.request('services/common/sendArr', null, noTaskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'sends table data when _executionTasks=true',
description: 'table payload with _executionTasks=true',
title: 'no inputs (runAsTask=true)',
description: 'no payload, runAsTask=true via config',
test: () =>
adapter
.request('services/common/sendArr&_executionTasks=true', tableData, {
useComputeApi: null
})
.request('services/common/sendArr', null, taskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'uploads as file when payload has semicolons',
description: 'semicolon payload, no _executionTasks flag',
title: 'one input table (runAsTask=false)',
description: 'single table payload, runAsTask explicitly disabled',
test: () =>
adapter
.request('services/common/sendArr', fileData, {
useComputeApi: null
})
.request('services/common/sendArr', tableData, noTaskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title:
'uploads as file when _executionTasks=true and payload has semicolons',
description: 'semicolon payload with _executionTasks=true',
title: 'one input table (runAsTask=true)',
description: 'single table payload, runAsTask=true via config',
test: () =>
adapter
.request('services/common/sendArr&_executionTasks=true', fileData, {
useComputeApi: null
})
.request('services/common/sendArr', tableData, taskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'multiple input tables (runAsTask=false)',
description: 'multi-table payload, runAsTask explicitly disabled',
test: () =>
adapter
.request('services/common/sendArr', multiTableData, noTaskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'multiple input tables (runAsTask=true)',
description: 'multi-table payload, runAsTask=true via config',
test: () =>
adapter
.request('services/common/sendArr', multiTableData, taskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'semicolon payload, single table, blob path (runAsTask=false)',
description: 'semicolon payload routes through blob path, runAsTask off',
test: () =>
adapter
.request('services/common/sendArr', fileData, noTaskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'semicolon payload, single table, blob path (runAsTask=true)',
description:
'semicolon payload (single table) routes through blob path, runAsTask=true',
test: () =>
adapter
.request('services/common/sendArr', fileData, taskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'semicolon payload, multi-table, blob path (runAsTask=false)',
description:
'semicolon payload (multi-table) routes through blob path, runAsTask off',
test: () =>
adapter
.request('services/common/sendArr', multiFileData, noTaskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true
},
{
title: 'semicolon payload, multi-table, blob path (runAsTask=true)',
description:
'semicolon payload (multi-table) routes through blob path, runAsTask=true',
test: () =>
adapter
.request('services/common/sendArr', multiFileData, taskConfig)
.then((res: any) => ({ ok: true, res }))
.catch((e: any) => ({ ok: false, error: e })),
assertion: (res: any) => res?.ok === true