mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 14:12:07 +02:00
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import { describe, test } from "@odoo/hoot";
|
|
import { Command, serverState } from "@web/../tests/web_test_helpers";
|
|
import { startServer, start, openDiscuss, contains } from "@mail/../tests/mail_test_helpers";
|
|
import { defineHrHolidaysModels } from "@hr_holidays/../tests/hr_holidays_test_helpers";
|
|
|
|
describe.current.tags("desktop");
|
|
defineHrHolidaysModels();
|
|
|
|
test("out of office message on direct chat with out of office partner", async () => {
|
|
const pyEnv = await startServer();
|
|
const partnerId = pyEnv["res.partner"].create({ name: "Demo", im_status: "online" });
|
|
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
|
|
const employee = pyEnv["hr.employee"].create({
|
|
user_id: userId,
|
|
leave_date_to: "2023-01-01",
|
|
});
|
|
pyEnv["res.users"].write([userId], {
|
|
employee_ids: [Command.link(employee)],
|
|
});
|
|
const channelId = pyEnv["discuss.channel"].create({
|
|
channel_member_ids: [
|
|
Command.create({ partner_id: serverState.partnerId }),
|
|
Command.create({ partner_id: partnerId }),
|
|
],
|
|
channel_type: "chat",
|
|
});
|
|
await start();
|
|
await openDiscuss(channelId);
|
|
await contains(".alert", { text: "Back on Jan 1, 2023" });
|
|
});
|