-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.test.ts
More file actions
24 lines (23 loc) · 924 Bytes
/
basic.test.ts
File metadata and controls
24 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { testSuite, expect } from "manten";
import { nrml, testCollection } from "../../common";
export default testSuite(async ({ describe }) => {
describe("remove", ({ test }) => {
test("it works", () => {
const collection = testCollection();
collection.insert({ a: 1 });
collection.insert({ a: 2 });
collection.insert({ a: 3 });
const removed = nrml(collection.remove({ a: 2 }));
const found = nrml(collection.find({ a: { $lt: 5 } }));
expect(removed).toEqual([{ a: 2 }]);
expect(found).toEqual([{ a: 1 }, { a: 3 }]);
});
test("normalizes internal id_map", () => {
const collection = testCollection({ integerIds: true });
collection.insert({ a: 1 });
expect(collection.data["internal"]["id_map"][3]).toBeDefined();
collection.remove({ a: 1 });
expect(collection.data["internal"]["id_map"][3]).toBeUndefined();
});
});
});