Skip to content

Commit

Permalink
[backend] Slightly modified test description
Browse files Browse the repository at this point in the history
  • Loading branch information
lim396 committed Feb 23, 2024
1 parent f97b1ec commit 04e5ee3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend/test/chat-gateway.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ describe('ChatGateway and ChatController (e2e)', () => {
describe('[joinDM]', () => {
// TODO
});
describe('Request match', () => {
describe('Tests on requests to users of pong matches', () => {
let userAndSockets: UserAndSocket[];

beforeAll(() => {
Expand Down Expand Up @@ -1508,12 +1508,15 @@ describe('ChatGateway and ChatController (e2e)', () => {
inviter = userAndSockets[1];

invitee.ws.on('request-match', mockCallback);
// First request
inviter.ws.emit('request-match', {
requestedUserId: invitee.user.id,
});
// Cancel request
inviter.ws.emit('cancel-match-request', {
requestedUserId: invitee.user.id,
});
// Second request after cancel
inviter.ws.emit('request-match', {
requestedUserId: invitee.user.id,
});
Expand Down Expand Up @@ -1624,14 +1627,16 @@ describe('ChatGateway and ChatController (e2e)', () => {
listener.ws.on('request-match', (data) => resolve(data)),
);
listener.ws.on('approved-match-request', mockToMatchByListener);

// Request match
emitter.ws.emit('request-match', {
requestedUserId: listener.user.id,
});
// Cancel request
return PromiseToInvite.then((data) => {
emitter.ws.emit('cancel-match-request', {
requestedUserId: data.requestedUserId,
});
// Approve request after cancel
setTimeout(() => {
listener.ws.emit('approve-match-request', {
approvedUserId: data.requestingUserId,
Expand Down

0 comments on commit 04e5ee3

Please sign in to comment.