mirror of
https://github.com/nvms/prsm.git
synced 2025-12-16 16:10:54 +00:00
29 lines
980 B
TypeScript
29 lines
980 B
TypeScript
import { testSuite, expect } from "manten";
|
|
import { nrml, testCollection } from "../../common";
|
|
|
|
export default testSuite(async ({ describe }) => {
|
|
describe("insert", ({ test }) => {
|
|
|
|
test("insert one", () => {
|
|
const collection = testCollection();
|
|
collection.insert({ foo: "bar" });
|
|
const found = nrml(collection.find({ foo: "bar" }));
|
|
expect(found).toEqual([{ foo: "bar" }]);
|
|
});
|
|
|
|
test("insert multiple", () => {
|
|
const collection = testCollection();
|
|
collection.insert([{ foo: "bar" }, { foo: "baz" }, { foo: "boo" }]);
|
|
const found = nrml(collection.find({ foo: { $includes: "b" } }));
|
|
expect(found).toEqual([{ foo: "bar" }, { foo: "baz" }, { foo: "boo" }]);
|
|
});
|
|
|
|
test("can insert emojis", () => {
|
|
const collection = testCollection();
|
|
collection.insert({ foo: "👍" });
|
|
const found = nrml(collection.find({ foo: "👍" }));
|
|
expect(found).toEqual([{ foo: "👍" }]);
|
|
});
|
|
|
|
});
|
|
}); |