From 4b2b47e544f1b49119ca8d1876dd6ac7519d9e79 Mon Sep 17 00:00:00 2001 From: Mahesh Bandara Wijerathna Date: Mon, 29 Nov 2021 15:37:33 +0530 Subject: [PATCH] Add test for decryption with incorrect key It's possible now since https://github.com/utelle/SQLite3MultipleCiphers/issues/55 is fixed. --- test/46.encryption.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/46.encryption.js b/test/46.encryption.js index 0da8cede..21b80f14 100644 --- a/test/46.encryption.js +++ b/test/46.encryption.js @@ -17,16 +17,11 @@ describe('Encryption using default method (Sqleet)', () => { this.db = new Database(util.current()); expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError); }); - /* - Temporarily commenting out this test since having `SQLITE_DEBUG` enabled - throws an assertion failure exception if an incorrect passphrase is used. - It cannot be caught in JS which leads to the whole test process being broken. - */ - // it('should not allow access with an incorrect passphrase', () => { - // this.db = new Database(util.current()); - // this.db.pragma(`key='false_passphrase'`); - // expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError); - // }); + it('should not allow access with an incorrect passphrase', () => { + this.db = new Database(util.current()); + this.db.pragma(`key='false_passphrase'`); + expect(() => this.db.prepare('SELECT * FROM user')).to.throw(Database.SqliteError); + }); it('should allow access with the correct passphrase', () => { this.db = new Database(util.current()); this.db.pragma(`key='passphrase'`);