Created
July 17, 2015 17:52
-
-
Save IuryAlves/fe5ad20bfeab94e83741 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("[bffdcas] EditarPerfilModel reset password ", function() { | |
var alertModel; | |
beforeEach(angular.mock.module('perfil_usuario')); | |
beforeEach(angular.mock.module('mockhttp')); | |
beforeEach(function (){ | |
// mocka o alertModel | |
alertModel = { | |
addAlert: function(message){} | |
}; | |
// espiona o método addAlert | |
sinon.spy(alertModel, 'addAlert'); | |
module(function($provide){ | |
$provide.value('alertModel', alertModel); | |
}); | |
}); | |
it('[dsadvvw] reset save image success', inject(function(EditarPerfilModel, $timeout){ | |
var m = EditarPerfilModel; | |
user_mock = { | |
birth: "17/10/1990", | |
id: "batman", | |
email :"iuryalves20+42@gmail.com", | |
gender :"M", | |
name: "bruce wayne" | |
}; | |
m.init(user_mock); | |
m.cropped_image = 'image_mock'; | |
m.save_image(); | |
$timeout.flush(); | |
// teste para verificar se o addAlert foi chamado com a mensagem 'Sua foto foi salva!' | |
expect(alertModel.addAlert.calledWith("Sua foto foi salva!")).equal(true); | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment