Debian Codegraph @

addons/point_of_sale/static/tests/unit/components/payment_screen.test.js

raw
1 import { test, animationFrame } from "@odoo/hoot";
2 import { mountWithCleanup } from "@web/../tests/web_test_helpers";
3 import { setupPosEnv, getFilledOrder, expectFormattedPrice } from "../utils";
4 import { definePosModels } from "../data/generate_model_definitions";
5 import { queryOne } from "@odoo/hoot-dom";
6 import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
7
8 definePosModels();
9
10 test("Change always incl", async () => {
11 const store = await setupPosEnv();
12 const order = await getFilledOrder(store);
13 const firstPm = store.models["pos.payment.method"].getFirst();
14 order.config.iface_tax_included = "total";
15 const comp = await mountWithCleanup(PaymentScreen, {
16 props: { orderUuid: order.uuid },
17 });
18 await comp.addNewPaymentLine(firstPm);
19 order.payment_ids[0].setAmount(20);
20 await animationFrame();
21 const total = queryOne(".amount");
22 expectFormattedPrice(total.attributes.amount.value, "$ -2.15");
23 order.config.iface_tax_included = "subtotal";
24 await animationFrame();
25 const subtotal = queryOne(".amount");
26 expectFormattedPrice(subtotal.attributes.amount.value, "$ -2.15");
27 });