fix: [expression] apply value equal for arrays, #589

This commit is contained in:
Harttle
2023-03-02 23:44:56 +08:00
parent 42d25902e8
commit 9c0dc5fa39
3 changed files with 38 additions and 10 deletions
+9
View File
@@ -53,6 +53,15 @@ describe('Expression', function () {
it('should return false for "1==2"', async () => {
expect(await toPromise(create('1==2').evaluate(ctx, false))).to.equal(false)
})
it('should apply deep equal for arrays', async () => {
const ctx = new Context({
arr1: [1, 2],
arr2: [1, 2],
arr3: [1, 2, 3],
})
expect(await toPromise(create('arr1==arr2').evaluate(ctx, false))).to.equal(true)
expect(await toPromise(create('arr1==arr3').evaluate(ctx, false))).to.equal(false)
})
it('should return true for "1<2"', async () => {
expect(await toPromise(create('1<2').evaluate(ctx, false))).to.equal(true)
})