From d6567cc97a4fb9ea0013f093887e73dbae210248 Mon Sep 17 00:00:00 2001 From: Abraham Elmahrek Date: Tue, 11 Jan 2022 10:12:51 -0800 Subject: [PATCH] change find operator test name --- package-lock.json | 5 ++-- test/find-operator.test.ts | 49 ++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 587a920..81c0416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,12 @@ { "name": "typeorm-encrypted", - "version": "0.5.6", + "version": "0.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.5.6", + "name": "typeorm-encrypted", + "version": "0.6.0", "license": "MIT", "devDependencies": { "@types/chai": "^4.2.13", diff --git a/test/find-operator.test.ts b/test/find-operator.test.ts index ebd1607..f646a25 100644 --- a/test/find-operator.test.ts +++ b/test/find-operator.test.ts @@ -3,7 +3,7 @@ import { Connection, In, Not, IsNull, Equal, Like, LessThan } from "typeorm"; import { getConnection } from "./utils"; import TransformerOptionsEntity3 from "./entities/TransformerOptionsEntity3"; -describe("Column Options - Data Mapper", function () { +describe("Find operator", function () { let connection: Connection; this.timeout(10000); @@ -21,8 +21,8 @@ describe("Column Options - Data Mapper", function () { // Where in const whereIn = await repo.find({ where: { - secret: In([secret1, secret2]) - } + secret: In([secret1, secret2]), + }, }); expect(whereIn.length).to.equal(2); expect(whereIn[0].secret).to.equal(secret1); @@ -30,32 +30,32 @@ describe("Column Options - Data Mapper", function () { // Where not const whereNot = await repo.find({ where: { - secret: Not(secret2) - } + secret: Not(secret2), + }, }); expect(whereNot.length).to.equal(1); expect(whereNot[0].secret).to.equal(secret1); // Where equal const whereEqual = await repo.find({ where: { - secret: Equal(secret1) - } + secret: Equal(secret1), + }, }); expect(whereEqual.length).to.equal(1); expect(whereEqual[0].secret).to.equal(secret1); // Where not in const whereNotIn = await repo.find({ where: { - secret: Not(In([secret2])) - } + secret: Not(In([secret2])), + }, }); expect(whereNotIn.length).to.equal(1); expect(whereNotIn[0].secret).to.equal(secret1); // Where IsNull const whereIsNull = await repo.find({ where: { - secret: IsNull() - } + secret: IsNull(), + }, }); expect(whereIsNull.length).to.equal(0); } finally { @@ -70,20 +70,23 @@ describe("Column Options - Data Mapper", function () { const secret2 = "test4"; await repo.save([{ secret: secret1 }, { secret: secret2 }]); // Can't use FindOperator except supported ones - for (const notSupportedOperator of [ - LessThan(secret1), - Like(secret1)]) { - await repo.find({ + for (const notSupportedOperator of [LessThan(secret1), Like(secret1)]) { + await repo + .find({ where: { - secret: notSupportedOperator + secret: notSupportedOperator, + }, + }) + .then( + () => { + throw new Error("Never resolved"); + }, + (reason) => { + expect(reason.message).to.equal( + 'Only "Equal","In", "Not", and "IsNull" are supported for FindOperator' + ); } - }).then( () => { - throw new Error("Never resolved") - }, (reason) => { - expect(reason.message).to.equal( - 'Only "Equal","In", "Not", and "IsNull" are supported for FindOperator' - ) - }); + ); } } finally { await repo.clear();