mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Fixed more tests
This commit is contained in:
@@ -12,6 +12,11 @@ describe('Settings Controller', function () {
|
||||
user = specHelper.newUser();
|
||||
User = {
|
||||
set: sandbox.stub(),
|
||||
reroll: sandbox.stub(),
|
||||
rebirth: sandbox.stub(),
|
||||
releasePets: sandbox.stub(),
|
||||
releaseMounts: sandbox.stub(),
|
||||
releaseBoth: sandbox.stub(),
|
||||
user: user
|
||||
};
|
||||
|
||||
@@ -123,7 +128,7 @@ describe('Settings Controller', function () {
|
||||
|
||||
scope.reroll(true);
|
||||
|
||||
expect(user.ops.reroll).to.be.calledWith({});
|
||||
expect(User.reroll).to.be.calledWith({});
|
||||
});
|
||||
|
||||
it('navigates to the tasks page when confirmed', function () {
|
||||
@@ -173,7 +178,7 @@ describe('Settings Controller', function () {
|
||||
|
||||
scope.rebirth(true);
|
||||
|
||||
expect(user.ops.rebirth).to.be.calledWith({});
|
||||
expect(User.rebirth).to.be.calledWith({});
|
||||
});
|
||||
|
||||
it('navigates to tasks page when confirmed', function () {
|
||||
@@ -216,9 +221,9 @@ describe('Settings Controller', function () {
|
||||
it('doesn\'t call any release method if type is not provided', function () {
|
||||
scope.releaseAnimals();
|
||||
|
||||
expect(User.user.ops.releasePets).to.not.be.called;
|
||||
expect(User.user.ops.releaseMounts).to.not.be.called;
|
||||
expect(User.user.ops.releaseBoth).to.not.be.called;
|
||||
expect(User.releasePets).to.not.be.called;
|
||||
expect(User.releaseMounts).to.not.be.called;
|
||||
expect(User.releaseBoth).to.not.be.called;
|
||||
});
|
||||
|
||||
it('doesn\'t redirect to tasks page if type is not provided', function () {
|
||||
@@ -230,7 +235,7 @@ describe('Settings Controller', function () {
|
||||
it('calls releasePets when "pets" is provided', function () {
|
||||
scope.releaseAnimals('pets');
|
||||
|
||||
expect(User.user.ops.releasePets).to.be.calledOnce;
|
||||
expect(User.releasePets).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('navigates to the tasks page when "pets" is provided', function () {
|
||||
@@ -242,7 +247,7 @@ describe('Settings Controller', function () {
|
||||
it('calls releaseMounts when "mounts" is provided', function () {
|
||||
scope.releaseAnimals('mounts');
|
||||
|
||||
expect(User.user.ops.releaseMounts).to.be.calledOnce;
|
||||
expect(User.releaseMounts).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('navigates to the tasks page when "mounts" is provided', function () {
|
||||
@@ -254,7 +259,7 @@ describe('Settings Controller', function () {
|
||||
it('calls releaseBoth when "both" is provided', function () {
|
||||
scope.releaseAnimals('both');
|
||||
|
||||
expect(User.user.ops.releaseBoth).to.be.calledOnce;
|
||||
expect(User.releaseBoth).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('navigates to the tasks page when "both" is provided', function () {
|
||||
@@ -266,9 +271,9 @@ describe('Settings Controller', function () {
|
||||
it('does not call release functions when non-applicable argument is passed in', function () {
|
||||
scope.releaseAnimals('dummy');
|
||||
|
||||
expect(User.user.ops.releasePets).to.not.be.called;
|
||||
expect(User.user.ops.releaseMounts).to.not.be.called;
|
||||
expect(User.user.ops.releaseBoth).to.not.be.called;
|
||||
expect(User.releasePets).to.not.be.called;
|
||||
expect(User.releaseMounts).to.not.be.called;
|
||||
expect(User.releaseBoth).to.not.be.called;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user