Skip to content

Commit

Permalink
test: updated createVisitor test util to use unique visitor names (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva authored Nov 5, 2024
1 parent d398866 commit dfd59e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/meteor/tests/e2e/utils/omnichannel/rooms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { faker } from '@faker-js/faker';

import { createFakeVisitor } from '../../../mocks/data';
import type { BaseTest } from '../test';

type UpdateRoomParams = { roomId: string; visitorId: string; tags: string[] };
Expand Down Expand Up @@ -66,10 +67,11 @@ export const createRoom = async (api: BaseTest['api'], { visitorToken, agentId }
};

export const createVisitor = async (api: BaseTest['api'], { name, token, departmentId }: CreateVisitorParams) => {
const fakeVisitor = createFakeVisitor();
const response = await api.post('/livechat/visitor', {
visitor: {
name: name || faker.person.fullName(),
email: faker.internet.email(),
name: name || fakeVisitor.name,
email: fakeVisitor.email,
token,
...(departmentId && { department: departmentId }),
},
Expand Down

0 comments on commit dfd59e5

Please sign in to comment.