Skip to content

Commit

Permalink
Add test for decryption with incorrect key
Browse files Browse the repository at this point in the history
It's possible now since utelle/SQLite3MultipleCiphers#55 is fixed.
  • Loading branch information
m4heshd committed Nov 29, 2021
1 parent 26976c3 commit 4b2b47e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test/46.encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'`);
Expand Down

0 comments on commit 4b2b47e

Please sign in to comment.