mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-10 08:54:35 +00:00
Compare commits
2 Commits
d0aaad024b
...
a3c5e985f7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3c5e985f7 | ||
|
|
68e0da8a91 |
@@ -1,43 +1,39 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
#app {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.app__error {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
padding: 30px;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
|
||||
h1 {
|
||||
color: #e74c3c;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.app__error {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
padding: 30px;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
|
||||
h1 {
|
||||
color: #e74c3c;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
@@ -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 = ''
|
||||
|
||||
31
sasjs-tests/src/testSuites/ViyaFile.ts
Normal file
31
sasjs-tests/src/testSuites/ViyaFile.ts
Normal file
@@ -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(
|
||||
`<html>` +
|
||||
` <head><title>Test</title></head>` +
|
||||
` <body><p>This is a test</p></body>` +
|
||||
`</html>`
|
||||
)
|
||||
// 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
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -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<string, string>
|
||||
|
||||
/**
|
||||
* Generic structure for a type's
|
||||
* 'properties' object from the Viya
|
||||
* types/types api response
|
||||
*/
|
||||
interface IViyaTypesProperties {
|
||||
[key: string]: string
|
||||
}
|
||||
type IViyaTypesProperties = Record<string, string>
|
||||
|
||||
/**
|
||||
* Arbitrary interface for storing
|
||||
|
||||
Reference in New Issue
Block a user