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

29 lines
629 B
TypeScript
Raw Normal View History

import { createAndFilter, createRangeFilter } from "../../src/graphql/filter";
2024-01-09 16:28:48 -07:00
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,
},
},
],
},
});
});
});