mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
26 lines
710 B
TypeScript
26 lines
710 B
TypeScript
import type { CrudOperators } from "@refinedev/core";
|
|
import { mapOperator } from "../../src/utils";
|
|
|
|
describe("mapOperator", () => {
|
|
it("should map CrudOperators to the corresponding operator strings", () => {
|
|
const inputToExpectedOutputMap = {
|
|
startswith: "startsWith",
|
|
endswith: "endsWith",
|
|
nin: "notIn",
|
|
ncontains: "notContainsi",
|
|
ncontainss: "notContains",
|
|
containss: "contains",
|
|
contains: "containsi",
|
|
nnull: "notNull",
|
|
eq: "eq",
|
|
gt: "gt",
|
|
};
|
|
|
|
for (const [input, expectedOutput] of Object.entries(
|
|
inputToExpectedOutputMap,
|
|
)) {
|
|
expect(mapOperator(input as CrudOperators)).toEqual(expectedOutput);
|
|
}
|
|
});
|
|
});
|