Skip to content

Commit

Permalink
Update 19-business-hours.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Apr 8, 2024
1 parent 134d910 commit a4ebb85
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions apps/meteor/tests/end-to-end/api/livechat/19-business-hours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,17 +838,22 @@ describe('LIVECHAT - business hours', function () {
expect(latestAgent.statusLivechat).to.be.undefined;
});

it('should verify a newly created agent to be assigned to the default business hour', async () => {
const agent = await createUser({ roles: ['user', 'livechat-agent'] });
const agentCredentials = await login(agent.username, password);

const latestAgent: ILivechatAgent = await getMe(agentCredentials as any);
expect(latestAgent).to.be.an('object');
expect(latestAgent.openBusinessHours).to.be.an('array').of.length(1);
expect(latestAgent?.openBusinessHours?.[0]).to.be.equal(defaultBH._id);

// cleanup
await deleteUser(agent);
describe('Special Case - Agent created, BH already enabled', () => {
let agent: ILivechatAgent;
let agentCredentials: IUserCredentialsHeader;
before(async () => {
agent = await createUser({ roles: ['user', 'livechat-agent'] });
agentCredentials = await login(agent.username, password);
});
after(async () => {
await deleteUser(agent);
});
it('should verify a newly created agent to be assigned to the default business hour', async () => {
const latestAgent: ILivechatAgent = await getMe(agentCredentials as any);
expect(latestAgent).to.be.an('object');
expect(latestAgent.openBusinessHours).to.be.an('array').of.length(1);
expect(latestAgent?.openBusinessHours?.[0]).to.be.equal(defaultBH._id);
});
});

after(async () => {
Expand Down

0 comments on commit a4ebb85

Please sign in to comment.