Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('Service: AuthFactory',function(){
- beforeEach(function () {
- module('ui.router');
- module('users');
- });
- var AuthFactory, httpBackend;
- beforeEach(function($httpBackend, _AuthFactory_) {
- httpBackend = $httpBackend;
- AuthFactory = _AuthFactory_;
- });
- it('should return POST', function(done) {
- AuthFactory.signIn({inputType: {user: "admin"}, credInput: {password: "pass123"}})
- .then(
- function(result) {
- console.log('======== SUCCESS ========');
- console.log(result);
- },
- function(err) {
- console.log('======== ERROR ========');
- console.log(err);
- })
- .then(function(){
- console.log('HTTP call finished.');
- expect(1).toBe(1);
- }).finally(done);
- }, 20000);
- });
- angular.module('users').factory('AuthFactory', ['$http', function($http) {
- var AuthFactory = {};
- AuthFactory.signIn = function(data) {
- return $http.post('http://localhost:3000/api/AuthFactoryServ/signIn', data);
- };
- AuthFactory.signOut = function(data) {
- return $http.post('http://localhost:3000/api/AuthFactoryServ/signOut', data);
- };
- return AuthFactory;
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement