How to use the angular-mocks.module function in angular-mocks

To help you get started, we’ve selected a few angular-mocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bjaanes / ExtremeResults-WebApp / tests / unit / directive / userSettings.directive.spec.js View on Github external
describe('User Settings Directive', function () {

        var rootScope,
            httpBackend,
            compile;

        beforeEach(module('xr.settings'));
        beforeEach(inject(function ($rootScope, $compile, $httpBackend) {
            rootScope = $rootScope;
            compile = $compile;
            httpBackend = $httpBackend;

            $httpBackend.whenGET('settings/userSettings/userSettings.partial.html').respond(200, '');
        }));

        it('should compile', function () {
            var element = angular.element('');
            compile(element)(rootScope);
            rootScope.$digest();
            httpBackend.flush();
        });

    });
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / editReflectionEntry.controller.spec.js View on Github external
describe('Edit Reflection Entry Controller', function(){

        var XrUtilsMock,
            q,
            rootScope,
            mdDialogMock,
            headerMock,
            formattedDateMock,
            confirmMock,
            EditReflectionEntryServiceMock,
            controller;

        beforeEach(module('xr.entry'));
        beforeEach(module(function ($provide) {
            headerMock = 'HEADERMOCKYMOCK';
            formattedDateMock = 'Some formatted date';

            XrUtilsMock = {
                getEntryHeader: function () {
                    return headerMock;
                },
                getFormattedEntryDate: function () {
                    return formattedDateMock;
                }
            };

            confirmMock = {
                title: function () {
                    return confirmMock;
                },
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / overview.controller.spec.js View on Github external
describe('Overview Controller', function(){

        var controller,
            OverviewServiceMock,
            rootScope,
            initDeferred,
            q;

        beforeEach(module('xr.overview'));
        beforeEach(module(function ($provide) {

            OverviewServiceMock = {
                getActiveEntries: function () {}
            };

            $provide.value('OverviewService', OverviewServiceMock);
        }));
        beforeEach(inject(function($controller, $q, $rootScope) {
            q = $q;
            rootScope = $rootScope;

            initDeferred = q.defer();
            spyOn(OverviewServiceMock, 'getActiveEntries').and.returnValue(initDeferred.promise);

            controller = $controller('OverviewController');
        }));
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / createReflection.controller.spec.js View on Github external
describe('CreateCreateReflection Controller', function(){

        var CreateReflectionServiceMock,
            controller,
            scope,
            rootScope,
            location,
            reflectionTypeMock,
            relatedEntriesDeferred,
            XrUtilsMock,
            formattedEntryDateMock,
            entryHeaderMock,
            q;

        beforeEach(module('xr.reflections'));
        beforeEach(module(function ($provide) {
            CreateReflectionServiceMock = {
                createReflection: function () {},
                getRelatedEntriesForReflection: function () {}
            };

            reflectionTypeMock = {
                className: 'Reflection',
                typeName: 'MockType'
            };

            formattedEntryDateMock = 'mockymockmockdate';
            entryHeaderMock = 'headheadheader';
            XrUtilsMock = {
                getFormattedEntryDate: function () { return formattedEntryDateMock },
                getEntryHeader: function () { return entryHeaderMock }
github bjaanes / ExtremeResults-WebApp / tests / unit / service / xrUtils.service.spec.js View on Github external
describe('XrUtils', function(){

        var XrUtils,
            filter,
            momentMock,
            mockWeekNumber;

        beforeEach(module('xr.core'));
        beforeEach(module(function ($provide) {
            mockWeekNumber = 42;
            momentMock = function () {
                return {
                    isoWeek: function () {
                        return mockWeekNumber;
                    },
                    month: function () {
                        return 0;
                    }
                }
            };

            momentMock.months = function () {
                return ["January","February","March","April","May","June","July","August","September","October","November","December"];
            };
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / hotSpots.controller.spec.js View on Github external
describe('Hot Spots controller', function(){

        var HotSpotsServiceMock,
            mdDialogMock,
            mdDialogDeferred,
            initDeferred,
            controller,
            rootScope,
            q;

        beforeEach(module('xr.hotSpots'));
        beforeEach(module(function ($provide) {
            HotSpotsServiceMock = {
                getHotSpotBuckets: function () {},
                createHotSpotBucket: function () {},
                editHotSpotBucket: function () {}
            };

            mdDialogMock = {
                show: function () {}
            };

            $provide.value('HotSpotsService', HotSpotsServiceMock);
            $provide.value('$mdDialog', mdDialogMock);
        }));
        beforeEach(inject(function($controller, $q, $rootScope) {
            q = $q;
            rootScope = $rootScope;
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / outcomeEntry.controller.spec.js View on Github external
describe('Outcome Entry Controller', function(){

        var XrUtilsMock,
            q,
            rootScope,
            mdDialogMock,
            headerMock,
            formattedDateMock,
            deleteDelegate,
            controller;

        beforeEach(module('xr.entry'));
        beforeEach(module(function ($provide) {
            headerMock = 'HEADERMOCKYMOCK';
            formattedDateMock = 'Some formatted date';

            XrUtilsMock = {
                getEntryHeader: function () {
                    return headerMock;
                },
                getFormattedEntryDate: function () {
                    return formattedDateMock;
                }
            };

            mdDialogMock = {
                show: function () {}
            };
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / editOutcomeEntry.controller.spec.js View on Github external
describe('Edit Outcome Entry Controller', function(){

        var XrUtilsMock,
            q,
            rootScope,
            mdDialogMock,
            headerMock,
            formattedDateMock,
            EditOutcomeEntryServiceMock,
            confirmMock,
            controller;

        beforeEach(module('xr.entry'));
        beforeEach(module(function ($provide) {
            headerMock = 'HEADERMOCKYMOCK';
            formattedDateMock = 'Some formatted date';

            XrUtilsMock = {
                getEntryHeader: function () {
                    return headerMock;
                },
                getFormattedEntryDate: function () {
                    return formattedDateMock;
                }
            };

            confirmMock = {
                title: function () {
                    return confirmMock;
                },
github bjaanes / ExtremeResults-WebApp / tests / unit / controller / outcomeEntry.controller.spec.js View on Github external
describe('Outcome Entry Controller', function(){

        var XrUtilsMock,
            q,
            rootScope,
            mdDialogMock,
            headerMock,
            formattedDateMock,
            deleteDelegate,
            controller;

        beforeEach(module('xr.entry'));
        beforeEach(module(function ($provide) {
            headerMock = 'HEADERMOCKYMOCK';
            formattedDateMock = 'Some formatted date';

            XrUtilsMock = {
                getEntryHeader: function () {
                    return headerMock;
                },
                getFormattedEntryDate: function () {
                    return formattedDateMock;
                }
            };

            mdDialogMock = {
                show: function () {}
            };
github bjaanes / ExtremeResults-WebApp / tests / unit / service / xrUtils.service.spec.js View on Github external
describe('XrUtils', function(){

        var XrUtils,
            filter,
            momentMock,
            mockWeekNumber;

        beforeEach(module('xr.core'));
        beforeEach(module(function ($provide) {
            mockWeekNumber = 42;
            momentMock = function () {
                return {
                    isoWeek: function () {
                        return mockWeekNumber;
                    },
                    month: function () {
                        return 0;
                    }
                }
            };

            momentMock.months = function () {
                return ["January","February","March","April","May","June","July","August","September","October","November","December"];
            };

angular-mocks

AngularJS mocks for testing

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis