mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 12:40:00 +00:00
v3 fix client tests for unlinking
This commit is contained in:
parent
2d63076369
commit
1b48ff4b8f
2 changed files with 13 additions and 4 deletions
|
|
@ -128,11 +128,19 @@ describe('Tasks Service', function() {
|
|||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('calls unlink task endpoint', function() {
|
||||
it('calls unlinkOneTask endpoint', function() {
|
||||
var taskId = 1;
|
||||
var keep = "keep";
|
||||
$httpBackend.expectPOST(apiV3Prefix + '/unlink-one/' + taskId + '?keep=' + keep).respond({});
|
||||
tasks.unlinkOneTask(taskId);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('calls unlinkAllTasks endpoint', function() {
|
||||
var challengeId = 1;
|
||||
var keep = "keep-all";
|
||||
$httpBackend.expectPOST(apiV3Prefix + '/unlink/' + taskId + '?keep=' + keep).respond({});
|
||||
tasks.unlinkTask(taskId);
|
||||
$httpBackend.expectPOST(apiV3Prefix + '/unlink-all/' + challengeId + '?keep=' + keep).respond({});
|
||||
tasks.unlinkAllTasks(challengeId);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||
.then(function (response) {
|
||||
_challenge = response.data.data;
|
||||
Notification.text(window.env.t('challengeCreated'));
|
||||
User.sync();
|
||||
|
||||
var challengeTasks = [];
|
||||
challengeTasks = challengeTasks.concat(challenge.todos);
|
||||
|
|
@ -146,6 +145,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||
$state.transitionTo('options.social.challenges.detail', { cid: _challenge._id }, {
|
||||
reload: true, inherit: false, notify: true
|
||||
});
|
||||
User.sync();
|
||||
});
|
||||
} else {
|
||||
Challenges.updateChallenge(challenge._id, challenge)
|
||||
|
|
@ -154,6 +154,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||
$state.transitionTo('options.social.challenges.detail', { cid: _challenge._id }, {
|
||||
reload: true, inherit: false, notify: true
|
||||
});
|
||||
User.sync();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue