Answer the question
In order to leave comments, you need to log in
Unit test problem in karma, how to solve?
test:
describe("root controller tests", function () {
var mockScope = {};
var controller;
beforeEach(angular.mock.module('blogApp'));
beforeEach(angular.mock.inject(function ($controller, $rootScope) {
mockScope = $rootScope.$new();
controller = $controller('rootController', {
$scope: mockScope
});
}));
it("init variables", function () {
expect(mockScope.loading).toBe(true);
expect(mockScope.creatingSuccess).toBe(false);
expect(mockScope.deletingSuccess).toBe(false);
expect(mockScope.updatingSuccess).toBe(false);
});
it('execute functions', function () {
mockScope.hideNotifications();
expect(mockScope.creatingSuccess).toBe(false);
expect(mockScope.deletingSuccess).toBe(false);
expect(mockScope.updatingSuccess).toBe(false);
});
});
files: [
'public/js/angular.js',
'public/js/angular-mocks.js',
'public/js/blogApp/blogApp.js',
'public/js/blogApp/blogServices.js',
'public/js/blogApp/blogControllers.js',
'public/js/blogApp/blogDirectives.js',
'public/js/blogApp/blogFilters.js',
'public/js/tests/blogTests/rootControllerTest.js'
],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question