mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Added summary field tests (#9883)
* Added summary field tests * Fixed typo
This commit is contained in:
@@ -314,5 +314,33 @@ describe('POST /challenges', () => {
|
||||
groupLeader = await groupLeader.sync();
|
||||
expect(groupLeader.achievements.joinedChallenge).to.be.true;
|
||||
});
|
||||
|
||||
it('sets summary to challenges name when not supplied', async () => {
|
||||
const name = 'Test Challenge';
|
||||
const challenge = await groupLeader.post('/challenges', {
|
||||
group: group._id,
|
||||
name,
|
||||
shortName: 'TC Label',
|
||||
});
|
||||
|
||||
const updatedChallenge = await groupLeader.get(`/challenges/${challenge._id}`);
|
||||
|
||||
expect(updatedChallenge.summary).to.eql(name);
|
||||
});
|
||||
|
||||
it('sets summary to challenges', async () => {
|
||||
const name = 'Test Challenge';
|
||||
const summary = 'Test Summary Challenge';
|
||||
const challenge = await groupLeader.post('/challenges', {
|
||||
group: group._id,
|
||||
name,
|
||||
shortName: 'TC Label',
|
||||
summary,
|
||||
});
|
||||
|
||||
const updatedChallenge = await groupLeader.get(`/challenges/${challenge._id}`);
|
||||
|
||||
expect(updatedChallenge.summary).to.eql(summary);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,6 +44,32 @@ describe('POST /group', () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('sets summary to groups name when not supplied', async () => {
|
||||
const name = 'Test Group';
|
||||
const group = await user.post('/groups', {
|
||||
name,
|
||||
type: 'guild',
|
||||
});
|
||||
|
||||
const updatedGroup = await user.get(`/groups/${group._id}`);
|
||||
|
||||
expect(updatedGroup.summary).to.eql(name);
|
||||
});
|
||||
|
||||
it('sets summary to groups', async () => {
|
||||
const name = 'Test Group';
|
||||
const summary = 'Test Summary';
|
||||
const group = await user.post('/groups', {
|
||||
name,
|
||||
type: 'guild',
|
||||
summary,
|
||||
});
|
||||
|
||||
const updatedGroup = await user.get(`/groups/${group._id}`);
|
||||
|
||||
expect(updatedGroup.summary).to.eql(summary);
|
||||
});
|
||||
});
|
||||
|
||||
context('Guilds', () => {
|
||||
|
||||
Reference in New Issue
Block a user