| 1 |
import { test, expect } from "@odoo/hoot"; |
| 2 |
import { mountWithCleanup } from "@web/../tests/web_test_helpers"; |
| 3 |
import { Orderline } from "@point_of_sale/app/components/orderline/orderline"; |
| 4 |
import { expectFormattedPrice, setupPosEnv } from "../utils"; |
| 5 |
import { definePosModels } from "../data/generate_model_definitions"; |
| 6 |
|
| 7 |
definePosModels(); |
| 8 |
|
| 9 |
test("orderline.js", async () => { |
| 10 |
const store = await setupPosEnv(); |
| 11 |
const order = store.addNewOrder(); |
| 12 |
const product = store.models["product.template"].get(5); |
| 13 |
const line = await store.addLineToOrder( |
| 14 |
{ |
| 15 |
product_tmpl_id: product, |
| 16 |
qty: 3, |
| 17 |
note: '[{"text":"Test 1","colorIndex":0},{"text":"Test 2","colorIndex":0}]', |
| 18 |
}, |
| 19 |
order |
| 20 |
); |
| 21 |
|
| 22 |
const comp = await mountWithCleanup(Orderline, { |
| 23 |
props: { line }, |
| 24 |
}); |
| 25 |
const lineData = comp.lineScreenValues; |
| 26 |
expect(comp.line.id).toEqual(line.id); |
| 27 |
expectFormattedPrice(comp.line.currencyDisplayPrice, "$ 10.35"); |
| 28 |
expect(lineData.internalNote).toEqual([ |
| 29 |
{ |
| 30 |
text: "Test 1", |
| 31 |
colorIndex: 0, |
| 32 |
}, |
| 33 |
{ |
| 34 |
text: "Test 2", |
| 35 |
colorIndex: 0, |
| 36 |
}, |
| 37 |
]); |
| 38 |
}); |