mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Client: Guild page and mix changes (#8533)
* update deps * add guilds page * improve karma conf, add tests for actions
This commit is contained in:
61
test/client/unit/specs/mixins/groupsUtilities.js
Normal file
61
test/client/unit/specs/mixins/groupsUtilities.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import groupsUtilities from 'client/mixins/groupsUtilities';
|
||||
import { TAVERN_ID } from 'common/script/constants';
|
||||
import Vue from 'vue';
|
||||
|
||||
describe('Groups Utilities Mixin', () => {
|
||||
let instance, user;
|
||||
|
||||
before(() => {
|
||||
instance = new Vue({
|
||||
mixins: [groupsUtilities],
|
||||
});
|
||||
|
||||
user = {
|
||||
_id: '123',
|
||||
party: {
|
||||
_id: '456',
|
||||
},
|
||||
guilds: ['789'],
|
||||
};
|
||||
});
|
||||
|
||||
describe('isMemberOfGroup', () => {
|
||||
it('registers as a method', () => {
|
||||
expect(instance.isMemberOfGroup).to.be.a.function;
|
||||
});
|
||||
|
||||
it('returns true when the group is the Tavern', () => {
|
||||
expect(instance.isMemberOfGroup(user, {
|
||||
_id: TAVERN_ID,
|
||||
})).to.equal(true);
|
||||
});
|
||||
|
||||
it('returns true when the group is the user\'s party', () => {
|
||||
expect(instance.isMemberOfGroup(user, {
|
||||
type: 'party',
|
||||
_id: user.party._id,
|
||||
})).to.equal(true);
|
||||
});
|
||||
|
||||
it('returns false when the group is not the user\'s party', () => {
|
||||
expect(instance.isMemberOfGroup(user, {
|
||||
type: 'party',
|
||||
_id: 'not my party',
|
||||
})).to.equal(false);
|
||||
});
|
||||
|
||||
it('returns true when the group is not a guild of which the user is a member', () => {
|
||||
expect(instance.isMemberOfGroup(user, {
|
||||
type: 'guild',
|
||||
_id: user.guilds[0],
|
||||
})).to.equal(true);
|
||||
});
|
||||
|
||||
it('returns false when the group is not a guild of which the user is a member', () => {
|
||||
expect(instance.isMemberOfGroup(user, {
|
||||
type: 'guild',
|
||||
_id: 'not my guild',
|
||||
})).to.equal(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user