mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-06 20:10:05 +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 () => {
|
||||
return adapter
|
||||
.request("common/makeErr", data, { debug: true })
|
||||
.catch((err) => {
|
||||
let sasRequests = adapter.getSasRequests();
|
||||
let makeErrRequest: any =
|
||||
.catch(() => {
|
||||
const sasRequests = adapter.getSasRequests();
|
||||
const makeErrRequest: any =
|
||||
sasRequests.find((req) => req.serviceLink.includes("makeErr")) ||
|
||||
null;
|
||||
|
||||
|
||||
@@ -106,8 +106,9 @@ export class WebJobExecutor extends BaseJobExecutor {
|
||||
let folderPath
|
||||
let jobName: string
|
||||
if (isRelativePath(sasJob)) {
|
||||
folderPath = sasJob.split('/')[0]
|
||||
jobName = sasJob.split('/')[1]
|
||||
const folderPathParts = sasJob.split('/')
|
||||
folderPath = folderPathParts.length > 1 ? folderPathParts[0] : ''
|
||||
jobName = folderPathParts.length > 1 ? folderPathParts[1] : ''
|
||||
} else {
|
||||
const folderPathParts = sasJob.split('/')
|
||||
jobName = folderPathParts.pop() || ''
|
||||
|
||||
@@ -85,21 +85,19 @@ describe('FileUploader', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// it('should throw an error when invalid JSON is returned by the server', async (done) => {
|
||||
// mockedAxios.post.mockImplementation(() =>
|
||||
// Promise.resolve({ data: '{invalid: "json"' })
|
||||
// )
|
||||
it('should throw an error when invalid JSON is returned by the server', async (done) => {
|
||||
mockedAxios.post.mockImplementation(() =>
|
||||
Promise.resolve({ data: '{invalid: "json"' })
|
||||
)
|
||||
|
||||
// const sasJob = 'test'
|
||||
// const { files, params } = prepareFilesAndParams()
|
||||
const sasJob = 'test'
|
||||
const { files, params } = prepareFilesAndParams()
|
||||
|
||||
// fileUploader.uploadFile(sasJob, files, params).catch((err: any) => {
|
||||
// expect(err.error.message).toEqual(
|
||||
// 'Error while parsing json from upload response.'
|
||||
// )
|
||||
// done()
|
||||
// })
|
||||
// })
|
||||
fileUploader.uploadFile(sasJob, files, params).catch((err: any) => {
|
||||
expect(err.error.message).toEqual('File upload request failed.')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should throw an error when the server request fails', async (done) => {
|
||||
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 './SASjsConfig'
|
||||
export * from './SASjsRequest'
|
||||
export * from './SASjsWaitingRequest'
|
||||
export * from './Session'
|
||||
export * from './UploadFile'
|
||||
export * from './PollOptions'
|
||||
|
||||
Reference in New Issue
Block a user