diff --git a/sasjs-tests/src/main.ts b/sasjs-tests/src/main.ts index b28b242..c31f444 100644 --- a/sasjs-tests/src/main.ts +++ b/sasjs-tests/src/main.ts @@ -22,6 +22,7 @@ import { sendArrTests, sendObjTests } from './testSuites/RequestData' import { fileUploadTests } from './testSuites/FileUpload' import { computeTests } from './testSuites/Compute' import { sasjsRequestTests } from './testSuites/SasjsRequests' +import { viyaFileTests } from './testSuites/ViyaFile' async function init() { const appContainer = document.getElementById('app') @@ -103,9 +104,10 @@ function showTests( fileUploadTests(adapter) ] - // Add compute tests for SASVIYA only + // Add certain tests for SASVIYA only if (adapter.getSasjsConfig().serverType === 'SASVIYA') { testSuites.push(computeTests(adapter, appLoc)) + testSuites.push(viyaFileTests(adapter, appLoc)) } container.innerHTML = '' diff --git a/sasjs-tests/src/testSuites/ViyaFile.ts b/sasjs-tests/src/testSuites/ViyaFile.ts new file mode 100644 index 0000000..db4ce17 --- /dev/null +++ b/sasjs-tests/src/testSuites/ViyaFile.ts @@ -0,0 +1,31 @@ +import SASjs from '@sasjs/adapter' +import type { TestSuite } from '../types' + +export const viyaFileTests = (adapter: SASjs, appLoc: string): TestSuite => ({ + name: 'SAS Viya File Tests', + tests: [ + { + title: 'Create html file', + description: 'Should create an html file with appropriate properties', + test: async () => { + const fileContentBuffer = Buffer.from( + `` + + `
This is a test
` + + `` + ) + // generate a timestamp string formatted as YYYYmmDDTHHMMSS_999 + const timeMark = new Date() + .toISOString() + .replace(/(\/|:|\s|-|Z)/g, '') + .replace(/\./g, '_') + const filename = `viya_createFile_test_${timeMark}.html` + return adapter.createFile(filename, fileContentBuffer, appLoc) + }, + assertion: () => { + //A test that returns a boolean + return true // dummy + } + } + ] +}) diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index e1f114e..c89375b 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -70,18 +70,14 @@ interface IViyaTypesItem { * in the links array of a Viya * types/types api response */ -interface IViyaTypesLink { - [key: string]: string -} +type IViyaTypesLink = Record