mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-10-27 19:22:55 +01:00
* Added notification for approval request in the group leaders language * Added test for group task meta actions. Added sync when user claims * Added tests for group task actions. Ensured assigned members are synce when added or removed * Fixed approval required toggle * Added support for users with comma in their name * Fixed sync issue when user is approved and reloads the website * Added advance options for group rewards * Added back ticks to group claim message * Fixed disappearing tasks that need approval * Up chat limit to 400 for subbed groups * Fixed line endings * Updated activie subscription check * Added group isSubscribed function * Changed to isAfter
43 lines
982 B
JavaScript
43 lines
982 B
JavaScript
describe('Group Task Actions Controller', () => {
|
|
let scope, user, userSerivce;
|
|
|
|
beforeEach(() => {
|
|
module(function($provide) {
|
|
$provide.value('User', {});
|
|
});
|
|
|
|
inject(($rootScope, $controller) => {
|
|
user = specHelper.newUser();
|
|
user._id = "unique-user-id";
|
|
userSerivce = {user: user};
|
|
userSerivce.sync = sandbox.stub();
|
|
|
|
scope = $rootScope.$new();
|
|
|
|
$controller('GroupTaskMetaActionsCtrl', {$scope: scope, User: userSerivce});
|
|
|
|
scope.task = {
|
|
group: {
|
|
assignedUsers: [],
|
|
},
|
|
};
|
|
});
|
|
});
|
|
|
|
describe('claim', () => {
|
|
beforeEach(() => {
|
|
sandbox.stub(window, 'confirm').returns(true);
|
|
});
|
|
|
|
it('adds user to assigned users of scope task ', () => {
|
|
scope.claim();
|
|
expect(scope.task.group.assignedUsers).to.contain(user._id);
|
|
});
|
|
|
|
it('syncs user tasks ', () => {
|
|
scope.claim();
|
|
expect(userSerivce.sync).to.be.calledOnce;
|
|
});
|
|
});
|
|
});
|