mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Api v3 fixes continued (#7205)
* Added timzeone offset back * Added APIToken back to settings page * Fixed fetch recent messages for party * Fixed returning group description * Fixed check if user is member of challenge * Fixed party members appearing in header * Updated get myGroups param to include public groups. Fixed isMemberOf group * Fixed hourglass purchase * Fixed challenge addding tasks on first creating * Updated tests to accomidate new changes
This commit is contained in:
committed by
Matteo Pagliazzi
parent
cc20812674
commit
1fd7df7521
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('Challenges Controller', function() {
|
||||
var rootScope, scope, user, User, ctrl, groups, members, notification, state, challenges;
|
||||
var rootScope, scope, user, User, ctrl, groups, members, notification, state, challenges, tasks;
|
||||
|
||||
beforeEach(function() {
|
||||
module(function($provide) {
|
||||
@@ -14,7 +14,7 @@ describe('Challenges Controller', function() {
|
||||
$provide.value('User', User);
|
||||
});
|
||||
|
||||
inject(function($rootScope, $controller, _$state_, _Groups_, _Members_, _Notification_, _Challenges_){
|
||||
inject(function($rootScope, $controller, _$state_, _Groups_, _Members_, _Notification_, _Challenges_, _Tasks_){
|
||||
scope = $rootScope.$new();
|
||||
rootScope = $rootScope;
|
||||
|
||||
@@ -24,6 +24,7 @@ describe('Challenges Controller', function() {
|
||||
ctrl = $controller('ChallengesCtrl', {$scope: scope, User: User});
|
||||
|
||||
challenges = _Challenges_;
|
||||
tasks = _Tasks_;
|
||||
groups = _Groups_;
|
||||
members = _Members_;
|
||||
notification = _Notification_;
|
||||
@@ -320,13 +321,17 @@ describe('Challenges Controller', function() {
|
||||
|
||||
context('challenge owner interactions', function() {
|
||||
describe("save challenge", function() {
|
||||
var alert, createChallengeSpy, challengeResponse;
|
||||
var alert, createChallengeSpy, challengeResponse, taskChallengeCreateSpy;
|
||||
|
||||
beforeEach(function(){
|
||||
alert = sandbox.stub(window, "alert");
|
||||
createChallengeSpy = sinon.stub(challenges, 'createChallenge');
|
||||
challengeResponse = {data: {data: {_id: 'new-challenge'}}};
|
||||
createChallengeSpy.returns(Promise.resolve(challengeResponse));
|
||||
|
||||
taskChallengeCreateSpy = sinon.stub(tasks, 'createChallengeTasks');
|
||||
var taskResponse = {data: {data: []}};
|
||||
taskChallengeCreateSpy.returns(Promise.resolve(taskResponse));
|
||||
});
|
||||
|
||||
it("opens an alert box if challenge.group is not specified", function() {
|
||||
|
||||
Reference in New Issue
Block a user