mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 16:40:06 +00:00
chore(*): clean up, address review comments
This commit is contained in:
@@ -28,9 +28,9 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
|
|||||||
test: async () => {
|
test: async () => {
|
||||||
return adapter
|
return adapter
|
||||||
.request("common/makeErr", data, { debug: true })
|
.request("common/makeErr", data, { debug: true })
|
||||||
.catch((err) => {
|
.catch(() => {
|
||||||
let sasRequests = adapter.getSasRequests();
|
const sasRequests = adapter.getSasRequests();
|
||||||
let makeErrRequest: any =
|
const makeErrRequest: any =
|
||||||
sasRequests.find((req) => req.serviceLink.includes("makeErr")) ||
|
sasRequests.find((req) => req.serviceLink.includes("makeErr")) ||
|
||||||
null;
|
null;
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,9 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
let folderPath
|
let folderPath
|
||||||
let jobName: string
|
let jobName: string
|
||||||
if (isRelativePath(sasJob)) {
|
if (isRelativePath(sasJob)) {
|
||||||
folderPath = sasJob.split('/')[0]
|
const folderPathParts = sasJob.split('/')
|
||||||
jobName = sasJob.split('/')[1]
|
folderPath = folderPathParts.length > 1 ? folderPathParts[0] : ''
|
||||||
|
jobName = folderPathParts.length > 1 ? folderPathParts[1] : ''
|
||||||
} else {
|
} else {
|
||||||
const folderPathParts = sasJob.split('/')
|
const folderPathParts = sasJob.split('/')
|
||||||
jobName = folderPathParts.pop() || ''
|
jobName = folderPathParts.pop() || ''
|
||||||
|
|||||||
@@ -85,21 +85,19 @@ describe('FileUploader', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// it('should throw an error when invalid JSON is returned by the server', async (done) => {
|
it('should throw an error when invalid JSON is returned by the server', async (done) => {
|
||||||
// mockedAxios.post.mockImplementation(() =>
|
mockedAxios.post.mockImplementation(() =>
|
||||||
// Promise.resolve({ data: '{invalid: "json"' })
|
Promise.resolve({ data: '{invalid: "json"' })
|
||||||
// )
|
)
|
||||||
|
|
||||||
// const sasJob = 'test'
|
const sasJob = 'test'
|
||||||
// const { files, params } = prepareFilesAndParams()
|
const { files, params } = prepareFilesAndParams()
|
||||||
|
|
||||||
// fileUploader.uploadFile(sasJob, files, params).catch((err: any) => {
|
fileUploader.uploadFile(sasJob, files, params).catch((err: any) => {
|
||||||
// expect(err.error.message).toEqual(
|
expect(err.error.message).toEqual('File upload request failed.')
|
||||||
// 'Error while parsing json from upload response.'
|
done()
|
||||||
// )
|
})
|
||||||
// done()
|
})
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
it('should throw an error when the server request fails', async (done) => {
|
it('should throw an error when the server request fails', async (done) => {
|
||||||
mockedAxios.post.mockImplementation(() =>
|
mockedAxios.post.mockImplementation(() =>
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* Represents requests that are queued, pending a signon event.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export interface SASjsWaitingRequest {
|
|
||||||
requestPromise: {
|
|
||||||
promise: any
|
|
||||||
resolve: any
|
|
||||||
reject: any
|
|
||||||
}
|
|
||||||
SASjob: string
|
|
||||||
data: any
|
|
||||||
config?: any
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ export * from './Link'
|
|||||||
export * from './LoginRequiredError'
|
export * from './LoginRequiredError'
|
||||||
export * from './SASjsConfig'
|
export * from './SASjsConfig'
|
||||||
export * from './SASjsRequest'
|
export * from './SASjsRequest'
|
||||||
export * from './SASjsWaitingRequest'
|
|
||||||
export * from './Session'
|
export * from './Session'
|
||||||
export * from './UploadFile'
|
export * from './UploadFile'
|
||||||
export * from './PollOptions'
|
export * from './PollOptions'
|
||||||
|
|||||||
Reference in New Issue
Block a user