mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 23:02:40 +01:00
Add chai-http to enable to.be.json assertions Re #132
This commit is contained in:
parent
2120a562da
commit
074d72d885
@ -18,6 +18,7 @@
|
||||
"@usebruno/schema": "0.3.1",
|
||||
"axios": "^0.26.0",
|
||||
"chai": "^4.3.7",
|
||||
"chai-http": "^4.3.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"dotenv": "^16.0.3",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
|
@ -6,6 +6,7 @@ const BrunoRequest = require('../bruno-request');
|
||||
const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser } = require('../utils');
|
||||
|
||||
const { expect } = chai;
|
||||
const chaiHttp = require('chai-http');
|
||||
|
||||
/**
|
||||
* Assertion operators
|
||||
@ -92,7 +93,7 @@ const evaluateRhsOperand = (rhsOperand, operator, context) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// gracefulle allyow both a,b as well as [a, b]
|
||||
// gracefully allow both a,b as well as [a, b]
|
||||
if(operator === 'in' || operator === 'notIn') {
|
||||
if(rhsOperand.startsWith('[') && rhsOperand.endsWith(']')) {
|
||||
rhsOperand = rhsOperand.substring(1, rhsOperand.length - 1);
|
||||
@ -225,6 +226,7 @@ class AssertRuntime {
|
||||
expect(lhs).to.be.false;
|
||||
break;
|
||||
case 'isJson':
|
||||
chai.use(chaiHttp);
|
||||
expect(lhs).to.be.json;
|
||||
break;
|
||||
case 'isNumber':
|
||||
@ -267,4 +269,4 @@ class AssertRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AssertRuntime;
|
||||
module.exports = AssertRuntime;
|
||||
|
Loading…
Reference in New Issue
Block a user