29 lines
625 B
TypeScript
29 lines
625 B
TypeScript
|
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,
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
});
|
||
|
});
|
||
|
});
|