main
| 1 | import { normalizeFieldsSelection } from "../normalize-fields-selection" |
| 2 | |
| 3 | describe("normalizeFieldsSelection", () => { |
| 4 | it("should normalize fields selection", () => { |
| 5 | const fields = [ |
| 6 | "product.id", |
| 7 | "product.title", |
| 8 | "product.variants.*", |
| 9 | "product.variants.prices.*", |
| 10 | ] |
| 11 | const result = normalizeFieldsSelection(fields) |
| 12 | expect(result).toEqual({ |
| 13 | product: { |
| 14 | id: true, |
| 15 | title: true, |
| 16 | variants: { |
| 17 | prices: true, |
| 18 | }, |
| 19 | }, |
| 20 | }) |
| 21 | }) |
| 22 | }) |