mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
feat: add 'isNotEmpty' assertion operator
This commit is contained in:
parent
aff7c405cd
commit
4a4481a26f
@ -20,6 +20,7 @@ import React from 'react';
|
|||||||
* endsWith : ends with
|
* endsWith : ends with
|
||||||
* between : between
|
* between : between
|
||||||
* isEmpty : is empty
|
* isEmpty : is empty
|
||||||
|
* isNotEmpty : is not empty
|
||||||
* isNull : is null
|
* isNull : is null
|
||||||
* isUndefined : is undefined
|
* isUndefined : is undefined
|
||||||
* isDefined : is defined
|
* isDefined : is defined
|
||||||
@ -51,6 +52,7 @@ const AssertionOperator = ({ operator, onChange }) => {
|
|||||||
'endsWith',
|
'endsWith',
|
||||||
'between',
|
'between',
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
|
@ -24,6 +24,7 @@ import { useTheme } from 'providers/Theme';
|
|||||||
* endsWith : ends with
|
* endsWith : ends with
|
||||||
* between : between
|
* between : between
|
||||||
* isEmpty : is empty
|
* isEmpty : is empty
|
||||||
|
* isNotEmpty : is not empty
|
||||||
* isNull : is null
|
* isNull : is null
|
||||||
* isUndefined : is undefined
|
* isUndefined : is undefined
|
||||||
* isDefined : is defined
|
* isDefined : is defined
|
||||||
@ -61,6 +62,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
'endsWith',
|
'endsWith',
|
||||||
'between',
|
'between',
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
@ -75,6 +77,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
|
|
||||||
const unaryOperators = [
|
const unaryOperators = [
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
@ -113,6 +116,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
const isUnaryOperator = (operator) => {
|
const isUnaryOperator = (operator) => {
|
||||||
const unaryOperators = [
|
const unaryOperators = [
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
|
@ -58,6 +58,7 @@ chai.use(function (chai, utils) {
|
|||||||
* endsWith : ends with
|
* endsWith : ends with
|
||||||
* between : between
|
* between : between
|
||||||
* isEmpty : is empty
|
* isEmpty : is empty
|
||||||
|
* isNotEmpty : is not empty
|
||||||
* isNull : is null
|
* isNull : is null
|
||||||
* isUndefined : is undefined
|
* isUndefined : is undefined
|
||||||
* isDefined : is defined
|
* isDefined : is defined
|
||||||
@ -95,6 +96,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
'endsWith',
|
'endsWith',
|
||||||
'between',
|
'between',
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
@ -109,6 +111,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
|
|
||||||
const unaryOperators = [
|
const unaryOperators = [
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
@ -147,6 +150,7 @@ const parseAssertionOperator = (str = '') => {
|
|||||||
const isUnaryOperator = (operator) => {
|
const isUnaryOperator = (operator) => {
|
||||||
const unaryOperators = [
|
const unaryOperators = [
|
||||||
'isEmpty',
|
'isEmpty',
|
||||||
|
'isNotEmpty',
|
||||||
'isNull',
|
'isNull',
|
||||||
'isUndefined',
|
'isUndefined',
|
||||||
'isDefined',
|
'isDefined',
|
||||||
@ -345,6 +349,14 @@ class AssertRuntime {
|
|||||||
case 'isEmpty':
|
case 'isEmpty':
|
||||||
expect(lhs).to.be.empty;
|
expect(lhs).to.be.empty;
|
||||||
break;
|
break;
|
||||||
|
case 'isNotEmpty':
|
||||||
|
expect(lhs).to.not.be.oneOf([null, 0, false, '', []]);
|
||||||
|
if (Array.isArray(lhs)) {
|
||||||
|
expect(lhs).to.have.length.above(0);
|
||||||
|
} else if (typeof lhs === 'object' && lhs !== null) {
|
||||||
|
expect(Object.keys(lhs)).to.have.length.above(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'isNull':
|
case 'isNull':
|
||||||
expect(lhs).to.be.null;
|
expect(lhs).to.be.null;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user