-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6574 from TheHollidayInn/api-v3-groups-seen-chat
Fixed send message and added intiial seen chat tests
- Loading branch information
Showing
3 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { | ||
createAndPopulateGroup, | ||
} from '../../../../helpers/api-v3-integration.helper'; | ||
|
||
describe('POST /groups/:id/chat/seen', () => { | ||
context('Guild', () => { | ||
let guild, guildLeader, guildMember, guildMessage; | ||
|
||
before(async () => { | ||
let { group, groupLeader, members } = await createAndPopulateGroup({ | ||
groupDetails: { | ||
type: 'guild', | ||
privacy: 'public', | ||
}, | ||
members: 1, | ||
}); | ||
|
||
guild = group; | ||
guildLeader = groupLeader; | ||
guildMember = members[0]; | ||
|
||
guildMessage = await guildLeader.post(`/groups/${guild._id}/chat`, { message: 'Some guild message' }); | ||
guildMessage = guildMessage.message; | ||
}); | ||
|
||
it('clears new messages for a guild', async () => { | ||
let user = await guildMember.get('/user'); | ||
|
||
await guildMember.post(`/groups/${guild._id}/chat/seen`); | ||
|
||
let guildThatHasSeenChat = await guildMember.get('/user'); | ||
|
||
expect(guildThatHasSeenChat.newMessages).to.be.empty; | ||
}); | ||
}); | ||
|
||
context('Party', () => { | ||
let party, partyLeader, partyMember, partyMessage; | ||
|
||
before(async () => { | ||
let { group, groupLeader, members } = await createAndPopulateGroup({ | ||
groupDetails: { | ||
type: 'party', | ||
privacy: 'private', | ||
}, | ||
members: 1, | ||
}); | ||
|
||
party = group; | ||
partyLeader = groupLeader; | ||
partyMember = members[0]; | ||
|
||
partyMessage = await partyLeader.post(`/groups/${party._id}/chat`, { message: 'Some party message' }); | ||
partyMessage = partyMessage.message; | ||
}); | ||
|
||
it('clears new messages for a party', async () => { | ||
let user = await partyMember.get('/user'); | ||
|
||
await partyMember.post(`/groups/${party._id}/chat/seen`); | ||
|
||
let partyMemberThatHasSeenChat = await partyMember.get('/user'); | ||
|
||
expect(partyMemberThatHasSeenChat.newMessages).to.be.empty; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters