0
私はユニットテストangularjsにジャスミンを使用し、多くの例を見始めるが、動作しない私はusersserviceを持っていると私はそれ のためのユニットテストを行う必要があり、私は仕事のデモジャスミンユニットテストの角度サービス
(function() {
'use strict';
angular
.module('app')
.factory('UserService', UserService);
UserService.$inject = ['$http'];
function UserService($http) {
var service = {};
service.GetAll = GetAll;
return service;
function GetAll(page) {
return $http.get('https://api.github.com/users').then(handleSuccess, handleError('Error getting all users'));
}
// private functions
function handleSuccess(res) {
return res.data;
}
function handleError(error) {
return function() {
return { success: false, message: error };
};
}
}})();
はい、それは細かいおかげで動作します –