angular-mock Questions

3

I've searched around quite a bit on this problem, but can't find a solution. I'm trying to mock my backend, which is well tested so I can completely isolate my frontend. I've tried using protracto...

3

Versions typescript: 2.1.4 systemjs: 0.19.41 angular: 1.5.10 angular-mocks: 1.5.10 Problem I'm trying to load angular-mocks with systemjs in a typescript 2.0 project. If i use the following it ...
Hezekiah asked 12/1, 2017 at 15:56

2

Solved

I feel I am missing something crucial in this extremely simplified angular directive unit test: import * as angular from 'angular' import 'angular-mocks' const app = angular.module('my-app', []) ...
Icily asked 30/3, 2017 at 6:56

1

Consider this code: import { Component, OnInit, Renderer, OnDestroy } from '@angular/core'; import { TranslateService } from 'ng2-translate/ng2-translate'; export class AppComponent imple...
Forage asked 22/10, 2016 at 19:39

2

Solved

I am trying to get familiar with testing an AngularJS application. While testing component logic is clear more or less, I have a trouble with html templates and model binding, because I'd like to t...
Greenbrier asked 15/1, 2018 at 9:37

7

Solved

I'm getting the following error in my karma unit test when trying to use inject() Example ✗ should wait for promise to resolve and have a result Error: timeout of 2000ms exceeded. Ensure the do...
Caveat asked 4/4, 2016 at 21:10

5

Solved

Is there a way to return an HttpPromise (or something similar) to mimic a call to $http? I want to set a global variable that indicates whether the real HTTP request is made or whether a fake HttpP...
Imprudent asked 24/6, 2014 at 15:11

2

Solved

I'm defining some setup code in the config function of an Angular module that I want to unit test. It is unclear to me how I should do this. Below is a simplified testcase that shows how I'm gettin...
Inpatient asked 11/8, 2016 at 15:13

2

Solved

I'm trying to test a module that uses angular-google-maps. It is failing because angular.mock.inject cannot find uiGmapGoogleMapApiProvider: Error: [$injector:unpr] Unknown provider: uiGmapGoogleM...
Florafloral asked 11/8, 2016 at 16:16

1

Solved

I have a simple factory angular.module('myApp.dice',[]).factory('Dice', ['$interval', function($interval){ return { rollDice: function(){ return $interval(function(c){ count++; }, 100, 18, fa...

1

Solved

I'm getting the exact error as found here: (window.beforeEach || window.setup) is not a function. However the fix did not work, the author of the tutorial series here even mentioned the same fix. H...
Swainson asked 17/2, 2016 at 15:41

1

Solved

I'm using MeteorJS with angular and want to test controller. My controller use $reactive(this).attach($scope). I need to check, if this method was called. I create something like that for spy: va...
Sepulchre asked 3/2, 2016 at 10:6

1

I find it incredibly frustrating that angular-mocks blocks all requests BY DEFAULT, and forcing me to "passthrough" what I want. Sometimes I simply want to test 1 url with a mock and I have to jum...
Gutty asked 3/8, 2015 at 18:44

5

I wrote this little code in separate .js file for frontend backendless environment. I need to get myfile.json whenever there is an ajax calling /somelink. angular.module('myApp') .config(function...
Wolfe asked 4/1, 2014 at 0:29

2

I'm using karma, mocha, chai, sinon and Angular mocks for my unit testing. In my $scope.loadChart, I'm drawing a chart in my canvas tag. I'm using http://www.chartjs.org/ to draw the charts. Char...
Jamiejamieson asked 26/5, 2015 at 8:59

2

I am using the Angular.js $httpBackend to test some services that wrap $http calls (this is in ngMock, not ngMockE2E). It seems that things like expect and when are sensitive to the order of URL q...
Paraphrastic asked 12/3, 2014 at 20:28

1

Solved

What is the difference between $httpBackend.when('') and $httpBackend.expect('')? I don't know the difference between these two methods. Also the angularjs api doc does not help me. API documenta...
Pericycle asked 14/1, 2015 at 14:54

3

I'm trying to setup an e2e test suite in angular, and need to return canned responses using $httpBackend. It would be nice if I could just return a file content, e.g. $httpBackend.whenPOST('/phon...
Guayule asked 11/1, 2014 at 1:38

2

Solved

I'm trying to create some unit tests in Angular using Jasmine being run through Teaspoon. The tests are running, however I have a simple test just to test the existence of a controller that is fail...
Godbeare asked 7/1, 2014 at 9:42

1

Solved

I would like to Jasmine test that Welcome.go has been called. Welcome is an angular service. angular.module('welcome',[]) .run(function(Welcome) { Welcome.go(); }); This is my test so far: d...

1

Solved

I have the following provider: angular.module('MyApp').provider('MyDevice', function () { var ngInjector = angular.injector(['ng']), $window = ngInjector.get('$window'); function isMobileDevi...
Penal asked 11/7, 2014 at 16:5

3

Solved

I want to test an Angular controller for my application fooApp, defined as follow: var fooApp = angular.module('fooApp', [ 'ngRoute', 'ngAnimate', 'hmTouchEvents' ]); ... The controller, MainCtr...

2

Solved

I am writing a frontend without backend ajax for now. I am using angular-mocks to simulate API call like this: $httpBackend.when('GET', '/somelink').respond(function(method, url, data) { //do som...
Ewold asked 24/2, 2014 at 9:0
1

© 2022 - 2024 — McMap. All rights reserved.