大佬教程收集整理的这篇文章主要介绍了angularjs – 在mean.js项目中运行npm test时出错,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
it('$scope.signin() should login with a correct user and password as user',function () { // Test expected GET request $httpBACkend.when('POST','/auth/signin').respond(200,{user: 'chinjubridgit.thomas@gmail.com',token: {logintoken: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'},isadmin: false,status:falsE}); scope.signin(); $httpBACkend.flush(); // Test scope value expect(scope.authentication.user).toEqual('chinjubridgit.thomas@gmail.com'); expect($cookieStore.get('token')).toBe('Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'); expect($LOCATIOn.url()).toEqual('/loading'); });
下面提供的是我在终端中运行npm test时得到的错误
PhantomJS 1.9.8 (Linux 0.0.0) AuthenticationController $scope.signin() should login with a correct user and password as user Failed Error: Unexpected request: GET modules/admins/views/admin/home-admin.client.view.html No more request expected at $httpBACkend (/home/dev241/projects/mean/yourcause/public/lib/angular-mocks/angular-mocks.js:1181) at sendReq (/home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:8427) at /home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:8146 at /home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:11682 at /home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:11768 at /home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:12811 at /home/dev241/projects/mean/yourcause/public/lib/angular/angular.js:12623 at /home/dev241/projects/mean/yourcause/public/lib/angular-mocks/angular-mocks.js:1454 at /home/dev241/projects/mean/yourcause/public/modules/users/tests/authentication.client.controller.test.js:72 at /home/dev241/projects/mean/yourcause/node_modules/karma-jasmine/lib/boot.js:126 at /home/dev241/projects/mean/yourcause/node_modules/karma-jasmine/lib/adapter.js:171 at http://localhost:9876/karma.js:182 at http://localhost:9876/context.html:175 PhantomJS 1.9.8 (Linux 0.0.0): Executed 11 of 11 (1 Failed) (0.011 secs / 0.172 secs)
$httpBACkend.when('GET',/\.html$/).respond('');
it('$scope.signin() should login with a correct user and password as user',function () { // Test expected GET request $httpBACkend.when('POST',status:falsE}); scope.signin(); $httpBACkend.when('GET',/\.html$/).respond(''); $httpBACkend.flush(); // Test scope value expect(scope.authentication.user).toEqual('jenson.raby@cubettech.com'); expect($cookieStore.get('token')).toBe('Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'); expect($LOCATIOn.url()).toEqual('/loading'); });
以上是大佬教程为你收集整理的angularjs – 在mean.js项目中运行npm test时出错全部内容,希望文章能够帮你解决angularjs – 在mean.js项目中运行npm test时出错所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。