import { beforeEach, expect, test } from "@odoo/hoot"; import { queryAll } from "@odoo/hoot-dom"; import { setupInteractionWhiteList, startInteractions } from "@web/../tests/public/helpers"; import { onRpc } from "@web/../tests/web_test_helpers"; import { registry } from "@web/core/registry"; import { Interaction } from "@web/public/interaction"; setupInteractionWhiteList([ "website_appointment.appointments", "website_appointment.test_appointment_item", ]); beforeEach(() => { class TestItem extends Interaction { static selector = ".s_test_item"; dynamicContent = { _root: { "t-att-data-started": (el) => `*${el.dataset.testParam}*`, }, }; } registry .category("public.interactions") .add("website_appointment.test_appointment_item", TestItem); }); test("dynamic snippet appointments loads items and displays them through template", async () => { onRpc("/website/snippet/filters", async (args) => { for await (const chunk of args.body) { const json = JSON.parse(new TextDecoder().decode(chunk)); expect(json.params.filter_id).toBe(1); expect(json.params.template_key).toBe( "website_appointment.dynamic_filter_template_appointment_type_card" ); expect(json.params.limit).toBe(4); expect(json.params.search_domain).toEqual([ "&", "&", ["schedule_based_on", "=", "resources"], ["resource_ids", "in", [1, 2]], ["name", "ilike", "tennis"], ]); } return [ `