Merge pull request #3522 from sanjai0py/feat/add-isNotEmpty-assertion

feat: add 'isNotEmpty' assertion operator
This commit is contained in:
lohit
2024-12-15 17:28:23 +05:30
committed by GitHub
3 changed files with 13 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import React from 'react';
* endsWith : ends with
* between : between
* isEmpty : is empty
* isNotEmpty : is not empty
* isNull : is null
* isUndefined : is undefined
* isDefined : is defined
@@ -51,6 +52,7 @@ const AssertionOperator = ({ operator, onChange }) => {
'endsWith',
'between',
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',

View File

@@ -24,6 +24,7 @@ import { useTheme } from 'providers/Theme';
* endsWith : ends with
* between : between
* isEmpty : is empty
* isNotEmpty : is not empty
* isNull : is null
* isUndefined : is undefined
* isDefined : is defined
@@ -61,6 +62,7 @@ const parseAssertionOperator = (str = '') => {
'endsWith',
'between',
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',
@@ -75,6 +77,7 @@ const parseAssertionOperator = (str = '') => {
const unaryOperators = [
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',
@@ -113,6 +116,7 @@ const parseAssertionOperator = (str = '') => {
const isUnaryOperator = (operator) => {
const unaryOperators = [
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',

View File

@@ -58,6 +58,7 @@ chai.use(function (chai, utils) {
* endsWith : ends with
* between : between
* isEmpty : is empty
* isNotEmpty : is not empty
* isNull : is null
* isUndefined : is undefined
* isDefined : is defined
@@ -95,6 +96,7 @@ const parseAssertionOperator = (str = '') => {
'endsWith',
'between',
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',
@@ -109,6 +111,7 @@ const parseAssertionOperator = (str = '') => {
const unaryOperators = [
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',
@@ -147,6 +150,7 @@ const parseAssertionOperator = (str = '') => {
const isUnaryOperator = (operator) => {
const unaryOperators = [
'isEmpty',
'isNotEmpty',
'isNull',
'isUndefined',
'isDefined',
@@ -345,6 +349,9 @@ class AssertRuntime {
case 'isEmpty':
expect(lhs).to.be.empty;
break;
case 'isNotEmpty':
expect(lhs).to.not.be.empty;
break;
case 'isNull':
expect(lhs).to.be.null;
break;