railbird-gql/test/graphql/filter.test.ts

29 lines
625 B
TypeScript
Raw Normal View History

2024-01-09 16:28:48 -07:00
import { createAndFilter, createRangeFilter } from "../../graphql/filter";
describe("create filterInput", () => {
it("should create a filter input with the correct structure", () => {
const feature = "cueObjectAngle";
const greaterThanEqualTo = 10;
const lessThan = 20;
const rangeFilter = createRangeFilter(
feature,
greaterThanEqualTo,
lessThan,
);
const andFilterInput = createAndFilter([rangeFilter]);
expect(andFilterInput.createVars()).toEqual({
andFilters: {
filters: [
{
[feature]: {
greaterThanEqualTo,
lessThan,
},
},
],
},
});
});
});