mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
v3 fix client tests for unlinking
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user