mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
v3 fix client tests for unlinking
This commit is contained in:
@@ -128,11 +128,19 @@ describe('Tasks Service', function() {
|
|||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls unlink task endpoint', function() {
|
it('calls unlinkOneTask endpoint', function() {
|
||||||
var taskId = 1;
|
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";
|
var keep = "keep-all";
|
||||||
$httpBackend.expectPOST(apiV3Prefix + '/unlink/' + taskId + '?keep=' + keep).respond({});
|
$httpBackend.expectPOST(apiV3Prefix + '/unlink-all/' + challengeId + '?keep=' + keep).respond({});
|
||||||
tasks.unlinkTask(taskId);
|
tasks.unlinkAllTasks(challengeId);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
_challenge = response.data.data;
|
_challenge = response.data.data;
|
||||||
Notification.text(window.env.t('challengeCreated'));
|
Notification.text(window.env.t('challengeCreated'));
|
||||||
User.sync();
|
|
||||||
|
|
||||||
var challengeTasks = [];
|
var challengeTasks = [];
|
||||||
challengeTasks = challengeTasks.concat(challenge.todos);
|
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 }, {
|
$state.transitionTo('options.social.challenges.detail', { cid: _challenge._id }, {
|
||||||
reload: true, inherit: false, notify: true
|
reload: true, inherit: false, notify: true
|
||||||
});
|
});
|
||||||
|
User.sync();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Challenges.updateChallenge(challenge._id, challenge)
|
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 }, {
|
$state.transitionTo('options.social.challenges.detail', { cid: _challenge._id }, {
|
||||||
reload: true, inherit: false, notify: true
|
reload: true, inherit: false, notify: true
|
||||||
});
|
});
|
||||||
|
User.sync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user