如何使用 jasmine 对这段代码进行单元测试?
$scope.profileObject = ProfilesSharedObject;
$scope.$watch("profileObject.startDate", function() {
var startDate = $scope.profileObject.startDate._d;
var endDate = $scope.profileObject.endDate._d;
var newStartDate = moment(startDate).format("YYYY-MM-DD");
var newEndDate = moment(endDate).format("YYYY-MM-DD");
$scope.startDate = moment(startDate).format("MM/DD");
$scope.endDate = moment(endDate).format("MM/DD/YYYY");
$scope.getSleepData(newStartDate, newEndDate);
});
其中 ProfileSharedObject 是一个角度 js 服务