Skip to content

Commit

Permalink
Added tests for new reindexing behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed Jul 1, 2021
1 parent 0453fef commit a84b522
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/CRUD.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,28 @@ describe("StormDB", function() {
});
});

describe(".delete()", function() {
it("should successfully remove value from database", function() {
describe(".delete()", function () {
it("should successfully delete from list without reindexing", function () {
const engine = new StormDB.localFileEngine(exampleDBPath);
const db = new StormDB(engine);

db.get("test-list").get(1).delete();

let value = db.get("test-list").get(1).value();
assert.strictEqual(value, undefined);
});

it("should successfully delete from with reindexing", function () {
const engine = new StormDB.localFileEngine(exampleDBPath);
const db = new StormDB(engine);

db.get("test-list").get(1).delete(true);

let value = db.get("test-list").get(1).value();
assert.strictEqual(value, 3);
});

it("should successfully remove value from database", function () {
const engine = new StormDB.localFileEngine(exampleDBPath);
const db = new StormDB(engine);

Expand Down

0 comments on commit a84b522

Please sign in to comment.