Add tests for in-memory database encryption

This commit is contained in:
Mahesh Bandara Wijerathna
2022-07-27 13:35:31 +05:30
parent 6ac5793aa0
commit cd2d8e3e0e
+9
View File
@@ -28,6 +28,10 @@ describe('Encryption using default cipher (Sqleet)', () => {
const stmt = this.db.prepare('SELECT * FROM user');
expect(stmt.get()).to.deep.equal({name: 'octocat'});
});
it('should not allow to encrypt an in-memory database', () => {
this.db = new Database(':memory:');
expect(() => this.db.pragma(`rekey='passphrase'`)).to.throw(Database.SqliteError);
});
});
describe('Encryption using SQLCiper', () => {
@@ -66,4 +70,9 @@ describe('Encryption using SQLCiper', () => {
const stmt = this.db.prepare('SELECT * FROM user');
expect(stmt.get()).to.deep.equal({name: 'octocat'});
});
it('should not allow to encrypt an in-memory database', () => {
this.db = new Database(':memory:');
this.db.pragma(`cipher='sqlcipher'`);
expect(() => this.db.pragma(`rekey='passphrase'`)).to.throw(Database.SqliteError);
});
});