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