Added IsArray on Assert (#2413)

Co-authored-by: Fabio Grande <fabio.grande@hdhome.it>
This commit is contained in:
Fabio GRANDE 2024-06-19 12:34:57 +02:00 committed by GitHub
parent d88bb68014
commit 9ec67b5da9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 7 deletions

View File

@ -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) => {

View File

@ -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);

View File

@ -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;