From ba78cbe2f23bf32c8a1cd6be27ac02e98feb2d4d Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Mon, 14 Apr 2025 15:44:30 -0300 Subject: [PATCH] chore: Livechat department incorrect param name (#35455) --- .../end-to-end/api/livechat/10-departments.ts | 29 +++++++++++++++++-- packages/rest-typings/src/v1/omnichannel.ts | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/apps/meteor/tests/end-to-end/api/livechat/10-departments.ts b/apps/meteor/tests/end-to-end/api/livechat/10-departments.ts index 9a92b6332d9..52ae177471c 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/10-departments.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/10-departments.ts @@ -222,7 +222,7 @@ import { IS_EE } from '../../../e2e/config/constants'; .expect(400); }); - it('should return an error if requestTagsBeforeClosing is true but no tags are provided', async () => { + it('should return an error if requestTagBeforeClosing is true but no tags are provided', async () => { await request .post(api('livechat/department')) .set(credentials) @@ -240,7 +240,7 @@ import { IS_EE } from '../../../e2e/config/constants'; .expect(400); }); - it('should return an error if requestTagsBeforeClosing is true but tags are not an array', async () => { + it('should return an error if requestTagBeforeClosing is true but tags are not an array', async () => { await request .post(api('livechat/department')) .set(credentials) @@ -259,6 +259,31 @@ import { IS_EE } from '../../../e2e/config/constants'; .expect(400); }); + it('should create department if requestTagBeforeClosing is true and tags are an array', async () => { + const chatClosingTags = ['tagA', 'tagB']; + const { body } = await request + .post(api('livechat/department')) + .set(credentials) + .send({ + department: { + name: 'Test', + enabled: true, + showOnOfflineForm: true, + showOnRegistration: true, + email: 'bla@bla', + requestTagBeforeClosingChat: true, + chatClosingTags, + }, + }) + .expect('Content-Type', 'application/json') + .expect(200); + + expect(body.department).to.have.property('requestTagBeforeClosingChat', true); + expect(body.department.chatClosingTags).to.deep.equal(chatClosingTags); + + await deleteDepartment(body.department._id); + }); + it('should return an error if fallbackForwardDepartment is present but is not a department id', async () => { await request .post(api('livechat/department')) diff --git a/packages/rest-typings/src/v1/omnichannel.ts b/packages/rest-typings/src/v1/omnichannel.ts index 834dc8efc45..51e5934864c 100644 --- a/packages/rest-typings/src/v1/omnichannel.ts +++ b/packages/rest-typings/src/v1/omnichannel.ts @@ -590,7 +590,7 @@ const POSTLivechatDepartmentSchema = { showOnOfflineForm: { type: 'boolean', }, - requestTagsBeforeClosingChat: { + requestTagBeforeClosingChat: { type: 'boolean', nullable: true, },