mirror of
https://github.com/hanzoai/better-sqlite3-multiple-ciphers.git
synced 2026-09-24 16:57:19 +00:00
Add tests for in-memory database encryption
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user