| 1 |
import { test, expect } from "@odoo/hoot"; |
| 2 |
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils"; |
| 3 |
import { CashMovePopup } from "@point_of_sale/app/components/popups/cash_move_popup/cash_move_popup"; |
| 4 |
import { mountWithCleanup } from "@web/../tests/web_test_helpers"; |
| 5 |
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions"; |
| 6 |
|
| 7 |
definePosModels(); |
| 8 |
|
| 9 |
test("_prepareTryCashInOutPayload", async () => { |
| 10 |
await setupPosEnv(); |
| 11 |
const comp = await mountWithCleanup(CashMovePopup, { |
| 12 |
props: { close: () => {} }, |
| 13 |
}); |
| 14 |
const result = comp._prepareTryCashInOutPayload(); |
| 15 |
const employee_id = result[result.length - 1].employee_id; |
| 16 |
expect(employee_id).toBe(2); |
| 17 |
}); |
| 18 |
test("partnerId", async () => { |
| 19 |
const store = await setupPosEnv(); |
| 20 |
const comp = await mountWithCleanup(CashMovePopup, { |
| 21 |
props: { close: () => {} }, |
| 22 |
}); |
| 23 |
const emp = store.models["hr.employee"].get(2); |
| 24 |
store.setCashier(emp); |
| 25 |
expect(comp.partnerId).toBe(emp.work_contact_id.id); |
| 26 |
}); |