Skip to content

Commit

Permalink
fix: request command data and config files checking bug (#253)
Browse files Browse the repository at this point in the history
* fix: request command data and config files checking bug

* tests: fixed request parameter

Co-authored-by: Krishna Acondy <[email protected]>
  • Loading branch information
medjedovicm and krishna-acondy authored Nov 21, 2020
1 parent da84b2d commit be11afe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/commands/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function runSasJob(commandLine) {
let dataJson
let configJson

if (dataFilePath !== 'default') {
if (dataFilePath) {
if (dataFilePath.split('.').slice(-1)[0] !== 'json') {
throw new Error('Provided data file must be valid json.')
}
Expand All @@ -40,7 +40,7 @@ export async function runSasJob(commandLine) {
}
}

if (configFilePath !== 'default') {
if (configFilePath) {
if (configFilePath.split('.').slice(-1)[0] !== 'json') {
throw new Error('Provided config file must be valid json.')
}
Expand Down
8 changes: 4 additions & 4 deletions test/commands/request/request.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('sasjs request', () => {
async () => {
await expect(
runRequest(
`request /Public/app/cli-tests-${timestamp}/runRequest/sendArr -d ${dataPathRel} -c default -t ${targetName}`
`request /Public/app/cli-tests-${timestamp}/runRequest/sendArr -d ${dataPathRel} -t ${targetName}`
)
).resolves.toEqual(true)
const rawData = await readFile(`${process.projectDir}/output.json`)
Expand All @@ -111,7 +111,7 @@ describe('sasjs request', () => {
async () => {
await expect(
runRequest(
`request /Public/app/cli-tests-${timestamp}/runRequest/sendObj -d ${dataPathRel} -c default -t ${targetName}`
`request /Public/app/cli-tests-${timestamp}/runRequest/sendObj -d ${dataPathRel} -t ${targetName}`
)
).resolves.toEqual(true)
const rawData = await readFile(`${process.projectDir}/output.json`)
Expand All @@ -131,7 +131,7 @@ describe('sasjs request', () => {
async () => {
await expect(
runRequest(
`request runRequest/sendArr -d ${dataPathRel} -c default -t ${targetName}`
`request runRequest/sendArr -d ${dataPathRel} -t ${targetName}`
)
).resolves.toEqual(true)

Expand All @@ -150,7 +150,7 @@ describe('sasjs request', () => {
async () => {
await expect(
runRequest(
`request runRequest/sendObj -d ${dataPathRel} -c default -t ${targetName}`
`request runRequest/sendObj -d ${dataPathRel} -t ${targetName}`
)
).resolves.toEqual(true)

Expand Down

0 comments on commit be11afe

Please sign in to comment.