Files
habitica/test/client-old/spec/controllers/groupTasksMetaActionCtrlSpec.js
Keith Holliday 28fec237fe Group plans misc fixes (#8388)
* 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
2017-01-18 07:54:49 -07:00

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;
});
});
});