mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 13:45:52 +00:00
Added IsArray on Assert (#2413)
Co-authored-by: Fabio Grande <fabio.grande@hdhome.it>
This commit is contained in:
@@ -32,6 +32,7 @@ import lightTheme from 'themes/light';
|
||||
* isNumber : is number
|
||||
* isString : is string
|
||||
* isBoolean : is boolean
|
||||
* isArray : is array
|
||||
*/
|
||||
|
||||
const AssertionOperator = ({ operator, onChange }) => {
|
||||
@@ -61,7 +62,8 @@ const AssertionOperator = ({ operator, onChange }) => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
const handleChange = (e) => {
|
||||
|
||||
@@ -33,6 +33,7 @@ import { useTheme } from 'providers/Theme';
|
||||
* isNumber : is number
|
||||
* isString : is string
|
||||
* isBoolean : is boolean
|
||||
* isArray : is array
|
||||
*/
|
||||
const parseAssertionOperator = (str = '') => {
|
||||
if (!str || typeof str !== 'string' || !str.length) {
|
||||
@@ -68,7 +69,8 @@ const parseAssertionOperator = (str = '') => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
const unaryOperators = [
|
||||
@@ -81,7 +83,8 @@ const parseAssertionOperator = (str = '') => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
const [operator, ...rest] = str.trim().split(' ');
|
||||
@@ -118,7 +121,8 @@ const isUnaryOperator = (operator) => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
return unaryOperators.includes(operator);
|
||||
|
||||
@@ -66,6 +66,7 @@ chai.use(function (chai, utils) {
|
||||
* isNumber : is number
|
||||
* isString : is string
|
||||
* isBoolean : is boolean
|
||||
* isArray : is array
|
||||
*/
|
||||
const parseAssertionOperator = (str = '') => {
|
||||
if (!str || typeof str !== 'string' || !str.length) {
|
||||
@@ -101,7 +102,8 @@ const parseAssertionOperator = (str = '') => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
const unaryOperators = [
|
||||
@@ -114,7 +116,8 @@ const parseAssertionOperator = (str = '') => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
const [operator, ...rest] = str.trim().split(' ');
|
||||
@@ -151,7 +154,8 @@ const isUnaryOperator = (operator) => {
|
||||
'isJson',
|
||||
'isNumber',
|
||||
'isString',
|
||||
'isBoolean'
|
||||
'isBoolean',
|
||||
'isArray'
|
||||
];
|
||||
|
||||
return unaryOperators.includes(operator);
|
||||
@@ -313,6 +317,9 @@ class AssertRuntime {
|
||||
case 'isBoolean':
|
||||
expect(lhs).to.be.a('boolean');
|
||||
break;
|
||||
case 'isArray':
|
||||
expect(lhs).to.be.a('array');
|
||||
break;
|
||||
default:
|
||||
expect(lhs).to.equal(rhs);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user