mercredi 2 septembre 2015

How would I mimic testing then() response with Jasmine, using AngularJs

Here's my code

   vm.initState = function () {
        guestService.isUserAdmin(status.standardId).then(function (isAdmin) {
            vm.isAdmin = isAdmin;
            vm.template = vm.isAdmin ? vm.templates[0] : vm.templates[1];
        }, function () {
            //TODO: display user error
        });
    };
    vm.initState();

I would like to know how to mimic this requests and where it should be done in SpyOn(), and if so I need to tests for response being returned as false and true.

Aucun commentaire:

Enregistrer un commentaire