diff --git a/packages/bruno-js/src/runtime/test-runtime.js b/packages/bruno-js/src/runtime/test-runtime.js index 966849d72..7fa9941ed 100644 --- a/packages/bruno-js/src/runtime/test-runtime.js +++ b/packages/bruno-js/src/runtime/test-runtime.js @@ -15,7 +15,7 @@ const BrunoRequest = require('../bruno-request'); const BrunoResponse = require('../bruno-response'); const Test = require('../test'); const TestResults = require('../test-results'); -const { cleanJson, appendAwaitToTestFunc } = require('../utils'); +const { cleanJson } = require('../utils'); // Inbuilt Library Support const ajv = require('ajv'); @@ -84,8 +84,6 @@ class TestRuntime { }; } - // add 'await' prefix to the test function calls - testsFile = appendAwaitToTestFunc(testsFile); const context = { test, diff --git a/packages/bruno-js/src/utils.js b/packages/bruno-js/src/utils.js index 3c99c48fb..e15ec09a7 100644 --- a/packages/bruno-js/src/utils.js +++ b/packages/bruno-js/src/utils.js @@ -142,15 +142,10 @@ const cleanJson = (data) => { } }; -const appendAwaitToTestFunc = (str) => { - return str.replace(/(? { describe('expression evaluation', () => { @@ -142,70 +137,4 @@ describe('utils', () => { expect(value).toBe(20); }); }); - - describe('appendAwaitToTestFunc function', () => { - it('example 1', () => { - const inputTestsString = ` - test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - `; - const ouutputTestsString = appendAwaitToTestFunc(inputTestsString); - expect(ouutputTestsString).toBe(` - await test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - `); - }); - - it('example 2', () => { - const inputTestsString = ` - await test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - `; - const ouutputTestsString = appendAwaitToTestFunc(inputTestsString); - expect(ouutputTestsString).toBe(` - await test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - await test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - await test("should return json", function() { - const data = res.getBody(); - expect(res.getBody()).to.eql({ - "hello": "bruno" - }); - }); - `); - }); - }); });