From f82b8e94679529c4261f171a3480a272f5d49a32 Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Wed, 14 Aug 2024 19:38:30 -0300 Subject: [PATCH 1/8] feat: Return departmentsAllowedToForward property in livechat/config endpoint --- apps/meteor/app/livechat/server/api/lib/livechat.ts | 3 ++- packages/livechat/src/definitions/departments.d.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/livechat/server/api/lib/livechat.ts b/apps/meteor/app/livechat/server/api/lib/livechat.ts index 617d255cb6cb..33103be499aa 100644 --- a/apps/meteor/app/livechat/server/api/lib/livechat.ts +++ b/apps/meteor/app/livechat/server/api/lib/livechat.ts @@ -29,7 +29,7 @@ async function findTriggers(): Promise[]> { +): Promise[]> { // TODO: check this function usage return ( await ( @@ -38,6 +38,7 @@ async function findDepartments( name: 1, showOnRegistration: 1, showOnOfflineForm: 1, + departmentsAllowedToForward: 1, }) ).toArray() ).map(({ _id, name, showOnRegistration, showOnOfflineForm }) => ({ diff --git a/packages/livechat/src/definitions/departments.d.ts b/packages/livechat/src/definitions/departments.d.ts index 765cfb104631..0d4f604b56e5 100644 --- a/packages/livechat/src/definitions/departments.d.ts +++ b/packages/livechat/src/definitions/departments.d.ts @@ -3,5 +3,7 @@ export type Department = { _id: string; name: string; showOnRegistration?: boolean; + showOnOfflineForm?: boolean; + departmentsAllowedToForward?: string[]; [key: string]: unknown; }; From 075460992da99e843c843613114509c8f48a911a Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Fri, 23 Aug 2024 16:10:29 -0300 Subject: [PATCH 2/8] improve return type --- .../app/livechat/server/api/lib/livechat.ts | 25 ++++++++----------- .../server/models/raw/LivechatDepartment.ts | 16 ++++++------ .../server/models/raw/LivechatDepartment.ts | 21 ++++++++++------ .../src/models/ILivechatDepartmentModel.ts | 10 +++++--- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/apps/meteor/app/livechat/server/api/lib/livechat.ts b/apps/meteor/app/livechat/server/api/lib/livechat.ts index 33103be499aa..31eb875b0612 100644 --- a/apps/meteor/app/livechat/server/api/lib/livechat.ts +++ b/apps/meteor/app/livechat/server/api/lib/livechat.ts @@ -32,21 +32,16 @@ async function findDepartments( ): Promise[]> { // TODO: check this function usage return ( - await ( - await LivechatDepartment.findEnabledWithAgentsAndBusinessUnit(businessUnit, { - _id: 1, - name: 1, - showOnRegistration: 1, - showOnOfflineForm: 1, - departmentsAllowedToForward: 1, - }) - ).toArray() - ).map(({ _id, name, showOnRegistration, showOnOfflineForm }) => ({ - _id, - name, - showOnRegistration, - showOnOfflineForm, - })); + await LivechatDepartment.findEnabledWithAgentsAndBusinessUnit< + Pick + >(businessUnit, { + _id: 1, + name: 1, + showOnRegistration: 1, + showOnOfflineForm: 1, + departmentsAllowedToForward: 1, + }) + ).toArray(); } export function findGuest(token: string): Promise { diff --git a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts index b5cd4c9500f3..d3c393995def 100644 --- a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts +++ b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts @@ -28,10 +28,10 @@ declare module '@rocket.chat/model-typings' { ): Promise; unfilteredRemove(query: Filter): Promise; removeParentAndAncestorById(id: string): Promise; - findEnabledWithAgentsAndBusinessUnit( + findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( businessUnit: string, - projection: FindOptions['projection'], - ): Promise>; + projection: FindOptions['projection'], + ): Promise>; findByParentId(parentId: string, options?: FindOptions): FindCursor; findAgentsByBusinessHourId(businessHourId: string): AggregationCursor<{ agentIds: string[] }>; } @@ -74,19 +74,19 @@ export class LivechatDepartmentEE extends LivechatDepartmentRaw implements ILive return this.updateMany({ parentId: id }, { $unset: { parentId: 1 }, $pull: { ancestors: id } }); } - async findEnabledWithAgentsAndBusinessUnit( + async findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( businessUnit: string, - projection: FindOptions['projection'], - ): Promise> { + projection: FindOptions['projection'], + ): Promise> { if (!businessUnit) { - return super.findEnabledWithAgents(projection); + return super.findEnabledWithAgents(projection); } const unit = await LivechatUnit.findOneById(businessUnit, { projection: { _id: 1 } }); if (!unit) { throw new Meteor.Error('error-unit-not-found', `Error! No Active Business Unit found with id: ${businessUnit}`); } - return super.findActiveByUnitIds([businessUnit], { projection }); + return super.findActiveByUnitIds([businessUnit], { projection }); } findByParentId(parentId: string, options?: FindOptions): FindCursor { diff --git a/apps/meteor/server/models/raw/LivechatDepartment.ts b/apps/meteor/server/models/raw/LivechatDepartment.ts index b8263af030a8..8e52d5160455 100644 --- a/apps/meteor/server/models/raw/LivechatDepartment.ts +++ b/apps/meteor/server/models/raw/LivechatDepartment.ts @@ -283,23 +283,25 @@ export class LivechatDepartmentRaw extends BaseRaw implemen return this.updateMany({ _id: { $in: _ids } }, { $inc: { numAgents: -1 } }); } - findEnabledWithAgents(projection: FindOptions['projection'] = {}): FindCursor { + findEnabledWithAgents = ILivechatDepartment>( + projection: FindOptions['projection'] = {}, + ): FindCursor { const query = { numAgents: { $gt: 0 }, enabled: true, }; - return this.find(query, projection && { projection }); + return this.find(query, projection && { projection }); } - async findEnabledWithAgentsAndBusinessUnit( + async findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( _: any, - projection: FindOptions['projection'] = {}, - ): Promise> { + projection: FindOptions['projection'] = {}, + ): Promise> { const query = { numAgents: { $gt: 0 }, enabled: true, }; - return this.find(query, projection && { projection }); + return this.find(query, projection && { projection }); } findOneByIdOrName(_idOrName: string, options: FindOptions = {}): Promise { @@ -328,7 +330,10 @@ export class LivechatDepartmentRaw extends BaseRaw implemen return this.find(query, options); } - findActiveByUnitIds(unitIds: string[], options: FindOptions = {}): FindCursor { + findActiveByUnitIds = ILivechatDepartment>( + unitIds: string[], + options: FindOptions = {}, + ): FindCursor { const query = { enabled: true, numAgents: { $gt: 0 }, @@ -338,7 +343,7 @@ export class LivechatDepartmentRaw extends BaseRaw implemen }, }; - return this.find(query, options); + return this.find(query, options); } findNotArchived(options: FindOptions = {}): FindCursor { diff --git a/packages/model-typings/src/models/ILivechatDepartmentModel.ts b/packages/model-typings/src/models/ILivechatDepartmentModel.ts index 75fe0f54b2eb..de5f4fbcbd87 100644 --- a/packages/model-typings/src/models/ILivechatDepartmentModel.ts +++ b/packages/model-typings/src/models/ILivechatDepartmentModel.ts @@ -52,11 +52,13 @@ export interface ILivechatDepartmentModel extends IBaseModel): Promise; updateNumAgentsById(_id: string, numAgents: number): Promise; decreaseNumberOfAgentsByIds(_ids: string[]): Promise; - findEnabledWithAgents(projection?: FindOptions['projection']): FindCursor; - findEnabledWithAgentsAndBusinessUnit( + findEnabledWithAgents = ILivechatDepartment>( + projection?: FindOptions['projection'], + ): FindCursor; + findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( _: any, - projection: FindOptions['projection'], - ): Promise>; + projection: FindOptions['projection'], + ): Promise>; findOneByIdOrName(_idOrName: string, options?: FindOptions): Promise; findByUnitIds(unitIds: string[], options?: FindOptions): FindCursor; findActiveByUnitIds(unitIds: string[], options?: FindOptions): FindCursor; From f889485a2c9bae8171ec008024f5e0304fa75690 Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Fri, 23 Aug 2024 16:10:38 -0300 Subject: [PATCH 3/8] add end-to-end tests --- apps/meteor/tests/data/livechat/department.ts | 6 +++ .../end-to-end/api/livechat/11-livechat.ts | 51 ++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/apps/meteor/tests/data/livechat/department.ts b/apps/meteor/tests/data/livechat/department.ts index 72ab0af9f267..23fc388e039c 100644 --- a/apps/meteor/tests/data/livechat/department.ts +++ b/apps/meteor/tests/data/livechat/department.ts @@ -47,9 +47,11 @@ const createDepartmentWithMethod = ( { allowReceiveForwardOffline = false, fallbackForwardDepartment, + departmentsAllowedToForward, }: { allowReceiveForwardOffline?: boolean; fallbackForwardDepartment?: string; + departmentsAllowedToForward?: string[]; } = {}, ) => new Promise((resolve, reject) => { @@ -70,6 +72,7 @@ const createDepartmentWithMethod = ( description: 'created from api', allowReceiveForwardOffline, fallbackForwardDepartment, + departmentsAllowedToForward, }, initialAgents, ], @@ -141,9 +144,11 @@ export const addOrRemoveAgentFromDepartment = async ( export const createDepartmentWithAnOfflineAgent = async ({ allowReceiveForwardOffline = false, fallbackForwardDepartment, + departmentsAllowedToForward, }: { allowReceiveForwardOffline?: boolean; fallbackForwardDepartment?: string; + departmentsAllowedToForward?: string[]; }): Promise<{ department: ILivechatDepartment; agent: { @@ -156,6 +161,7 @@ export const createDepartmentWithAnOfflineAgent = async ({ const department = (await createDepartmentWithMethod(undefined, { allowReceiveForwardOffline, fallbackForwardDepartment, + departmentsAllowedToForward, })) as ILivechatDepartment; await addOrRemoveAgentFromDepartment(department._id, { agentId: user._id, username: user.username }, true); diff --git a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts index c07f7bcecc81..1a99e2176389 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts @@ -4,7 +4,12 @@ import { after, before, describe, it } from 'mocha'; import { sleep } from '../../../../lib/utils/sleep'; import { getCredentials, api, request, credentials } from '../../../data/api-data'; import { createCustomField, deleteCustomField } from '../../../data/livechat/custom-fields'; -import { addOrRemoveAgentFromDepartment, createDepartmentWithAnOnlineAgent } from '../../../data/livechat/department'; +import { + addOrRemoveAgentFromDepartment, + createDepartmentWithAnOfflineAgent, + createDepartmentWithAnOnlineAgent, + deleteDepartment, +} from '../../../data/livechat/department'; import { createVisitor, createLivechatRoom, @@ -12,9 +17,11 @@ import { closeOmnichannelRoom, sendMessage, deleteVisitor, + createDepartment, } from '../../../data/livechat/rooms'; import { createBotAgent, getRandomVisitorToken } from '../../../data/livechat/users'; import { removePermissionFromAllRoles, restorePermissionToRoles, updatePermission, updateSetting } from '../../../data/permissions.helper'; +import { deleteUser } from '../../../data/users.helper'; import { IS_EE } from '../../../e2e/config/constants'; describe('LIVECHAT - Utils', () => { @@ -171,6 +178,48 @@ describe('LIVECHAT - Utils', () => { expect(body.config).to.have.property('room'); expect(body.config.room).to.have.property('_id', newRoom._id); }); + it('should return list of departments with at least one agent', async () => { + const emptyDepartment = await createDepartment(); + const { department: forwardDepartment, agent } = await createDepartmentWithAnOnlineAgent(); + const { department: testDepartment, agent: agent2 } = await createDepartmentWithAnOfflineAgent({ + departmentsAllowedToForward: [forwardDepartment._id], + }); + + const { body } = await request.get(api('livechat/config')).set(credentials); + + expect(body).to.have.property('success', true); + expect(body).to.have.property('config'); + expect(body.config).to.have.property('departments'); + expect(body.config.departments).to.be.an('array').with.lengthOf.at.least(2); + + expect(body.config.departments).to.not.deep.include({ + _id: emptyDepartment._id, + name: emptyDepartment.name, + showOnRegistration: emptyDepartment.showOnRegistration, + showOnOfflineForm: emptyDepartment.showOnOfflineForm, + }); + expect(body.config.departments).to.deep.include({ + _id: forwardDepartment._id, + name: forwardDepartment.name, + showOnRegistration: forwardDepartment.showOnRegistration, + showOnOfflineForm: forwardDepartment.showOnOfflineForm, + }); + expect(body.config.departments).to.deep.include({ + _id: testDepartment._id, + name: testDepartment.name, + showOnRegistration: testDepartment.showOnRegistration, + showOnOfflineForm: testDepartment.showOnOfflineForm, + departmentsAllowedToForward: [forwardDepartment._id], + }); + + await Promise.all([ + deleteDepartment(emptyDepartment._id), + deleteDepartment(forwardDepartment._id), + deleteDepartment(testDepartment._id), + deleteUser(agent.user), + deleteUser(agent2.user), + ]); + }); }); describe('livechat/page.visited', () => { From 025d3bd8264d34b07931dd74ea45d5992b0f3326 Mon Sep 17 00:00:00 2001 From: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:14:55 -0300 Subject: [PATCH 4/8] Create changeset --- .changeset/beige-kiwis-count.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/beige-kiwis-count.md diff --git a/.changeset/beige-kiwis-count.md b/.changeset/beige-kiwis-count.md new file mode 100644 index 000000000000..a318de427a02 --- /dev/null +++ b/.changeset/beige-kiwis-count.md @@ -0,0 +1,7 @@ +--- +"@rocket.chat/meteor": minor +"@rocket.chat/livechat": minor +"@rocket.chat/model-typings": minor +--- + +Added `departmentsAllowedToForward` property to departments returned in the `livechat/config` endpoint From c8d3ee14b08f13a1ced67579e7c735e0132c3eef Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Fri, 23 Aug 2024 17:05:15 -0300 Subject: [PATCH 5/8] only run new test in EE --- apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts index 1a99e2176389..8c61eb3c04ca 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts @@ -178,7 +178,7 @@ describe('LIVECHAT - Utils', () => { expect(body.config).to.have.property('room'); expect(body.config.room).to.have.property('_id', newRoom._id); }); - it('should return list of departments with at least one agent', async () => { + (IS_EE ? it : it.skip)('should return list of departments with at least one agent', async () => { const emptyDepartment = await createDepartment(); const { department: forwardDepartment, agent } = await createDepartmentWithAnOnlineAgent(); const { department: testDepartment, agent: agent2 } = await createDepartmentWithAnOfflineAgent({ From 0d479221cbe5460b422b059757dc3831ceb998c1 Mon Sep 17 00:00:00 2001 From: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:13:29 -0300 Subject: [PATCH 6/8] Improve typing again --- apps/meteor/server/models/raw/LivechatDepartment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/server/models/raw/LivechatDepartment.ts b/apps/meteor/server/models/raw/LivechatDepartment.ts index 8e52d5160455..a5567f4c889b 100644 --- a/apps/meteor/server/models/raw/LivechatDepartment.ts +++ b/apps/meteor/server/models/raw/LivechatDepartment.ts @@ -284,7 +284,7 @@ export class LivechatDepartmentRaw extends BaseRaw implemen } findEnabledWithAgents = ILivechatDepartment>( - projection: FindOptions['projection'] = {}, + projection: FindOptions['projection'] = {}, ): FindCursor { const query = { numAgents: { $gt: 0 }, From 7980ee9eb6000ad2bafae0c54bc7841c94cf33bc Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Thu, 29 Aug 2024 21:14:51 -0300 Subject: [PATCH 7/8] use extends Document instead of Partial --- .../meteor/ee/server/models/raw/LivechatDepartment.ts | 4 ++-- apps/meteor/server/models/raw/LivechatDepartment.ts | 11 +++-------- .../src/models/ILivechatDepartmentModel.ts | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts index d3c393995def..3586c4b836d1 100644 --- a/apps/meteor/ee/server/models/raw/LivechatDepartment.ts +++ b/apps/meteor/ee/server/models/raw/LivechatDepartment.ts @@ -28,7 +28,7 @@ declare module '@rocket.chat/model-typings' { ): Promise; unfilteredRemove(query: Filter): Promise; removeParentAndAncestorById(id: string): Promise; - findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( + findEnabledWithAgentsAndBusinessUnit( businessUnit: string, projection: FindOptions['projection'], ): Promise>; @@ -74,7 +74,7 @@ export class LivechatDepartmentEE extends LivechatDepartmentRaw implements ILive return this.updateMany({ parentId: id }, { $unset: { parentId: 1 }, $pull: { ancestors: id } }); } - async findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( + async findEnabledWithAgentsAndBusinessUnit( businessUnit: string, projection: FindOptions['projection'], ): Promise> { diff --git a/apps/meteor/server/models/raw/LivechatDepartment.ts b/apps/meteor/server/models/raw/LivechatDepartment.ts index a5567f4c889b..e1607760db7d 100644 --- a/apps/meteor/server/models/raw/LivechatDepartment.ts +++ b/apps/meteor/server/models/raw/LivechatDepartment.ts @@ -283,9 +283,7 @@ export class LivechatDepartmentRaw extends BaseRaw implemen return this.updateMany({ _id: { $in: _ids } }, { $inc: { numAgents: -1 } }); } - findEnabledWithAgents = ILivechatDepartment>( - projection: FindOptions['projection'] = {}, - ): FindCursor { + findEnabledWithAgents(projection: FindOptions['projection'] = {}): FindCursor { const query = { numAgents: { $gt: 0 }, enabled: true, @@ -293,7 +291,7 @@ export class LivechatDepartmentRaw extends BaseRaw implemen return this.find(query, projection && { projection }); } - async findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( + async findEnabledWithAgentsAndBusinessUnit( _: any, projection: FindOptions['projection'] = {}, ): Promise> { @@ -330,10 +328,7 @@ export class LivechatDepartmentRaw extends BaseRaw implemen return this.find(query, options); } - findActiveByUnitIds = ILivechatDepartment>( - unitIds: string[], - options: FindOptions = {}, - ): FindCursor { + findActiveByUnitIds(unitIds: string[], options: FindOptions = {}): FindCursor { const query = { enabled: true, numAgents: { $gt: 0 }, diff --git a/packages/model-typings/src/models/ILivechatDepartmentModel.ts b/packages/model-typings/src/models/ILivechatDepartmentModel.ts index de5f4fbcbd87..f12c82475236 100644 --- a/packages/model-typings/src/models/ILivechatDepartmentModel.ts +++ b/packages/model-typings/src/models/ILivechatDepartmentModel.ts @@ -52,10 +52,10 @@ export interface ILivechatDepartmentModel extends IBaseModel): Promise; updateNumAgentsById(_id: string, numAgents: number): Promise; decreaseNumberOfAgentsByIds(_ids: string[]): Promise; - findEnabledWithAgents = ILivechatDepartment>( + findEnabledWithAgents( projection?: FindOptions['projection'], ): FindCursor; - findEnabledWithAgentsAndBusinessUnit = ILivechatDepartment>( + findEnabledWithAgentsAndBusinessUnit( _: any, projection: FindOptions['projection'], ): Promise>; From b9d35c9d646137ad179069aa8b4f93f7b44f9d2d Mon Sep 17 00:00:00 2001 From: matheusbsilva137 Date: Tue, 8 Oct 2024 20:35:38 -0300 Subject: [PATCH 8/8] Use more before and after in tests --- .../end-to-end/api/livechat/11-livechat.ts | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts index 8d07be63b1a7..3012a1afb4d6 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/11-livechat.ts @@ -1,3 +1,5 @@ +import type { Credentials } from '@rocket.chat/api-client'; +import type { ILivechatDepartment, IUser } from '@rocket.chat/core-typings'; import { expect } from 'chai'; import { after, before, describe, it } from 'mocha'; @@ -20,6 +22,7 @@ import { createDepartment, } from '../../../data/livechat/rooms'; import { createBotAgent, getRandomVisitorToken } from '../../../data/livechat/users'; +import type { WithRequiredProperty } from '../../../data/livechat/utils'; import { removePermissionFromAllRoles, restorePermissionToRoles, updatePermission, updateSetting } from '../../../data/permissions.helper'; import { deleteUser } from '../../../data/users.helper'; import { IS_EE } from '../../../e2e/config/constants'; @@ -78,6 +81,38 @@ describe('LIVECHAT - Utils', () => { }); describe('livechat/config', () => { + let emptyDepartment: ILivechatDepartment; + let forwardDepartment: ILivechatDepartment; + let testDepartment: ILivechatDepartment; + let agent: { user: WithRequiredProperty; credentials: Credentials }; + let agent2: { user: WithRequiredProperty; credentials: Credentials }; + + before(async () => { + if (!IS_EE) { + return; + } + + emptyDepartment = await createDepartment(); + ({ department: forwardDepartment, agent } = await createDepartmentWithAnOnlineAgent()); + ({ department: testDepartment, agent: agent2 } = await createDepartmentWithAnOfflineAgent({ + departmentsAllowedToForward: [forwardDepartment._id], + })); + }); + + after(() => { + if (!IS_EE) { + return; + } + + return Promise.all([ + deleteDepartment(emptyDepartment._id), + deleteDepartment(forwardDepartment._id), + deleteDepartment(testDepartment._id), + deleteUser(agent.user), + deleteUser(agent2.user), + ]); + }); + it('should return enabled: false if livechat is disabled', async () => { await updateSetting('Livechat_enabled', false); const { body } = await request.get(api('livechat/config')).set(credentials); @@ -179,12 +214,6 @@ describe('LIVECHAT - Utils', () => { expect(body.config.room).to.have.property('_id', newRoom._id); }); (IS_EE ? it : it.skip)('should return list of departments with at least one agent', async () => { - const emptyDepartment = await createDepartment(); - const { department: forwardDepartment, agent } = await createDepartmentWithAnOnlineAgent(); - const { department: testDepartment, agent: agent2 } = await createDepartmentWithAnOfflineAgent({ - departmentsAllowedToForward: [forwardDepartment._id], - }); - const { body } = await request.get(api('livechat/config')).set(credentials); expect(body).to.have.property('success', true); @@ -211,14 +240,6 @@ describe('LIVECHAT - Utils', () => { showOnOfflineForm: testDepartment.showOnOfflineForm, departmentsAllowedToForward: [forwardDepartment._id], }); - - await Promise.all([ - deleteDepartment(emptyDepartment._id), - deleteDepartment(forwardDepartment._id), - deleteDepartment(testDepartment._id), - deleteUser(agent.user), - deleteUser(agent2.user), - ]); }); });