prsm/packages/arc/tests/specs/operators/boolean/length.test.ts
2024-08-28 09:08:33 -04:00

18 lines
647 B
TypeScript

import { testSuite, expect } from "manten";
import { nrml, testCollection } from "../../../common";
export default testSuite(async ({ describe }) => {
describe("$length", ({ test }) => {
test("works", () => {
const collection = testCollection();
collection.insert({ foo: [0, 0] });
collection.insert({ foo: [0, 0, 0] });
collection.insert({ foo: [0, 0, 0] });
collection.insert({ foo: "abc" });
collection.insert({ foo: "abcd" });
const found = nrml(collection.find({ foo: { $length: 3 } }));
expect(found).toEqual([{ foo: [0, 0, 0] }, { foo: [0, 0, 0] }, { foo: "abc" }]);
});
});
});