prsm/packages/arc/tests/specs/insert/basic.test.ts
2024-08-28 09:08:33 -04:00

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: "👍" }]);
});
});
});