diff --git a/packages/bruno-cli/src/runner/run-single-request.js b/packages/bruno-cli/src/runner/run-single-request.js index 0d3a99e82..1f9b6ba41 100644 --- a/packages/bruno-cli/src/runner/run-single-request.js +++ b/packages/bruno-cli/src/runner/run-single-request.js @@ -161,7 +161,7 @@ const runSingleRequest = async function ( // run assertions let assertionResults = []; const assertions = get(bruJson, 'request.assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); assertionResults = assertRuntime.runAssertions( assertions, @@ -185,7 +185,7 @@ const runSingleRequest = async function ( // run tests let testResults = []; const testFile = get(bruJson, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const result = await testRuntime.runTests( testFile, @@ -266,7 +266,7 @@ const runSingleRequest = async function ( // run assertions let assertionResults = []; const assertions = get(bruJson, 'request.assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); assertionResults = assertRuntime.runAssertions( assertions, @@ -290,7 +290,7 @@ const runSingleRequest = async function ( // run tests let testResults = []; const testFile = get(bruJson, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const result = await testRuntime.runTests( testFile, diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index d4cfa48b1..6c1bec01a 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -291,7 +291,7 @@ const registerNetworkIpc = (mainWindow) => { // run assertions const assertions = get(request, 'assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); const results = assertRuntime.runAssertions( assertions, @@ -313,7 +313,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const testResults = await testRuntime.runTests( testFile, @@ -365,7 +365,7 @@ const registerNetworkIpc = (mainWindow) => { if (error && error.response) { // run assertions const assertions = get(request, 'assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); const results = assertRuntime.runAssertions( assertions, @@ -387,7 +387,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const testResults = await testRuntime.runTests( testFile, @@ -702,7 +702,7 @@ const registerNetworkIpc = (mainWindow) => { // run assertions const assertions = get(item, 'request.assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); const results = assertRuntime.runAssertions( assertions, @@ -723,7 +723,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const testResults = await testRuntime.runTests( testFile, @@ -781,7 +781,7 @@ const registerNetworkIpc = (mainWindow) => { // run assertions const assertions = get(item, 'request.assertions'); - if (assertions && assertions.length) { + if (assertions) { const assertRuntime = new AssertRuntime(); const results = assertRuntime.runAssertions( assertions, @@ -802,7 +802,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testFile = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - if (testFile && testFile.length) { + if (typeof testFile === 'string') { const testRuntime = new TestRuntime(); const testResults = await testRuntime.runTests( testFile,