19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:29:53 +01:00
parent 6e54c1af6c
commit 3ca647e428
1087 changed files with 132065 additions and 108499 deletions

View file

@ -0,0 +1,25 @@
import { test, expect } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { CashierName } from "@point_of_sale/app/components/navbar/cashier_name/cashier_name";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
test("avatarAndCssClass", async () => {
await setupPosEnv();
const comp = await mountWithCleanup(CashierName, {});
expect(comp.avatar).toBe("/web/image/hr.employee.public/2/avatar_128");
expect(comp.cssClass).toMatchObject({ oe_status: true });
});
test("selectCashier", async () => {
const store = await setupPosEnv();
const comp = await mountWithCleanup(CashierName, {});
const result = await comp.selectCashier();
expect(result.name).toBe("Employee1");
expect(result.id).toBe(3);
store.setCashier(result);
const value = store.getCashier();
expect(value.name).toBe("Employee1");
expect(value.id).toBe(3);
});

View file

@ -0,0 +1,23 @@
import { test, expect } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { Navbar } from "@point_of_sale/app/components/navbar/navbar";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
test("showCreateProductButtonWithAdmin", async () => {
const store = await setupPosEnv();
const admin = store.models["hr.employee"].get(2);
store.setCashier(admin);
const comp = await mountWithCleanup(Navbar, {});
expect(comp.showCreateProductButton).toBe(true);
});
test("showCreateProductButtonWithNonAdmin", async () => {
const store = await setupPosEnv();
const emp = store.models["hr.employee"].get(3);
store.setCashier(emp);
const comp = await mountWithCleanup(Navbar, {});
expect(comp.showCreateProductButton).toBe(false);
});

View file

@ -0,0 +1,26 @@
import { test, expect } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { CashMovePopup } from "@point_of_sale/app/components/popups/cash_move_popup/cash_move_popup";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
test("_prepareTryCashInOutPayload", async () => {
await setupPosEnv();
const comp = await mountWithCleanup(CashMovePopup, {
props: { close: () => {} },
});
const result = comp._prepareTryCashInOutPayload();
const employee_id = result[result.length - 1].employee_id;
expect(employee_id).toBe(2);
});
test("partnerId", async () => {
const store = await setupPosEnv();
const comp = await mountWithCleanup(CashMovePopup, {
props: { close: () => {} },
});
const emp = store.models["hr.employee"].get(2);
store.setCashier(emp);
expect(comp.partnerId).toBe(emp.work_contact_id.id);
});

View file

@ -0,0 +1,27 @@
import { test, expect } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { ProductInfoPopup } from "@point_of_sale/app/components/popups/product_info_popup/product_info_popup";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
test("allowProductEdition", async () => {
const store = await setupPosEnv();
store.addNewOrder();
const admin = store.models["hr.employee"].get(2);
store.setCashier(admin);
const product = store.models["product.template"].get(5);
const info = await store.getProductInfo(product, 1);
const comp = await mountWithCleanup(ProductInfoPopup, {
props: {
productTemplate: product,
info,
close: () => {},
},
});
expect(comp.allowProductEdition).toBe(true);
const emp = store.models["hr.employee"].get(3);
store.setCashier(emp);
expect(comp.allowProductEdition).toBe(false);
});

View file

@ -0,0 +1,22 @@
import { test, expect, describe } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { LoginScreen } from "@point_of_sale/app/screens/login_screen/login_screen";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
describe("pos_login_screen.js", () => {
test("openRegister", async () => {
const store = await setupPosEnv();
const comp = await mountWithCleanup(LoginScreen, {});
comp.openRegister();
expect(store.login).toBe(true);
});
test("backBtnName", async () => {
const store = await setupPosEnv();
store.login = true;
const comp = await mountWithCleanup(LoginScreen, {});
expect(comp.backBtnName).toBe("Discard");
});
});

View file

@ -0,0 +1,19 @@
import { test, expect } from "@odoo/hoot";
import { setupPosEnv } from "@point_of_sale/../tests/unit/utils";
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
import { mountWithCleanup } from "@web/../tests/web_test_helpers";
import { definePosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
definePosModels();
test("validateOrder", async () => {
const store = await setupPosEnv();
store.addNewOrder();
const orderUuid = store.getOrder().uuid;
const comp = await mountWithCleanup(PaymentScreen, {
props: { orderUuid },
});
await comp.validateOrder();
const order = store.getOrder();
expect(order.employee_id.id).toBe(2);
});