mirror of
https://github.com/nvms/prsm.git
synced 2025-12-16 00:00:52 +00:00
33 lines
762 B
TypeScript
33 lines
762 B
TypeScript
import { testSuite, expect } from "manten";
|
|
import { nrml, testCollectionEncrypted } from "../../common";
|
|
|
|
export default testSuite(async ({ test }) => {
|
|
test("can write", () => {
|
|
const collection = testCollectionEncrypted<{a: number}>({
|
|
name: "enc",
|
|
});
|
|
collection.drop();
|
|
collection.insert({ a: 1 });
|
|
collection.insert({ a: 2 });
|
|
collection.insert({ a: 3 });
|
|
collection.sync();
|
|
|
|
expect(nrml(collection.find({ a: 1 }))).toEqual([{ a: 1 }]);
|
|
});
|
|
|
|
test("can read", () => {
|
|
const collection = testCollectionEncrypted<{a: number}>({
|
|
name: "enc",
|
|
});
|
|
|
|
const found = nrml(collection.find({ a: { $gt: 0 } }));
|
|
|
|
expect(found).toEqual([
|
|
{ a: 1 },
|
|
{ a: 2 },
|
|
{ a: 3 },
|
|
]);
|
|
});
|
|
});
|
|
|