Skip to content

Commit 20cee75

Browse files
committed
Fixing test issues
1 parent 69e0552 commit 20cee75

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/field-level-encryption.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ describe("Field Level Encryption", () => {
190190

191191
describe("#decrypt", () => {
192192
const fle = new FieldLevelEncryption(testConfig);
193-
const jweFle = new FieldLevelEncryption(testConfigJwe);
194193
const decrypt = FieldLevelEncryption.__get__("decrypt");
195194

196195
it("decrypt response", () => {
@@ -334,10 +333,9 @@ describe("Field Level Encryption", () => {
334333
}
335334
});
336335

337-
const fle = new FieldLevelEncryption(testConfigJwe);
338-
const encrypt = FieldLevelEncryption.__get__("encrypt");
339-
340336
it("encrypt body payload", () => {
337+
const fle = new FieldLevelEncryption(testConfigJwe);
338+
const encrypt = FieldLevelEncryption.__get__("encrypt");
341339
const res = encrypt.call(fle, "/resource", null,
342340
{
343341
elem1: {
@@ -362,10 +360,9 @@ describe("Field Level Encryption", () => {
362360
}
363361
});
364362

365-
const fle = new FieldLevelEncryption(testConfigJwe);
366-
const decrypt = FieldLevelEncryption.__get__("decrypt");
367-
368363
it("decrypt response", () => {
364+
const fle = new FieldLevelEncryption(testConfigJwe);
365+
const decrypt = FieldLevelEncryption.__get__("decrypt");
369366
const response = require("./mock/jwe-response");
370367
const res = decrypt.call(fle, response);
371368
assert.ok(res.foo.accountNumber === "5123456789012345");

test/payload-encryption.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe("Payload encryption", () => {
1313
const jweConfig = JSON.parse(JSON.stringify(jweTestConfig));
1414
jweConfig['encryptedValueFieldName'] = "encryptedValue";
1515
const fle = new FieldLevelEncryption(config);
16-
const jweFle = new FieldLevelEncryption(jweConfig);
1716
const encryptBody = FieldLevelEncryption.__get__("encryptBody");
1817
const decryptBody = FieldLevelEncryption.__get__("decryptBody");
1918

@@ -198,6 +197,7 @@ describe("Payload encryption", () => {
198197
});
199198

200199
it("jwe with sibling", () => {
200+
const jweFle = new FieldLevelEncryption(jweConfig);
201201
const body = {
202202
data: {
203203
field1: "value1",
@@ -214,6 +214,7 @@ describe("Payload encryption", () => {
214214
});
215215

216216
it("jwe destination obj not exists", () => {
217+
const jweFle = new FieldLevelEncryption(jweConfig);
217218
const body = {
218219
itemsToEncrypt: {
219220
first: "first",
@@ -234,6 +235,7 @@ describe("Payload encryption", () => {
234235
});
235236

236237
it("jwe elem not found", () => {
238+
const jweFle = new FieldLevelEncryption(jweConfig);
237239
const body = {
238240
itemsToEncrypt: {
239241
first: "first",
@@ -253,6 +255,7 @@ describe("Payload encryption", () => {
253255
});
254256

255257
it("jwe nested object to encrypt", () => {
258+
const jweFle = new FieldLevelEncryption(jweConfig);
256259
const body = {
257260
path: {
258261
to: {
@@ -274,6 +277,7 @@ describe("Payload encryption", () => {
274277
});
275278

276279
it("jwe nested object, create different nested object and delete it", () => {
280+
const jweFle = new FieldLevelEncryption(jweConfig);
277281
const body = {
278282
path: {
279283
to: {
@@ -306,6 +310,7 @@ describe("Payload encryption", () => {
306310
});
307311

308312
it("jwe nested properties, create new obj", () => {
313+
const jweFle = new FieldLevelEncryption(jweConfig);
309314
const body = {
310315
path: {
311316
to: {

0 commit comments

Comments
 (0)