Docs

Angular tests

ng-describe is available out of the box, for you to write fluent tests for your angular app.

ng-describe makes it very easy to test components, services, inject dependencies and mock ajax calls.
You can browse the tests available for the login or register components.

📘

Angular Generators

for components, directives and services automatically generate the ng-descrive spec file. You would just need to implement the test cases.

ngDescribe({
    name: 'Test forgot-password component',
    modules: 'app',
    inject: '$http',
    element: '<forgot-password></forgot-password>',
    http: {
        post: {
            '/api/auth/password/email': {
                data: true
            }
        }
    },
    tests: function(deps) {

        it('should request email verification successfully', () => {
            var component = deps.element.isolateScope().vm;

            component.email = '[email protected]';
            component.submit();

            deps.http.flush();
        });
    }
});

Did this page help you?