-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(star wars): add test fixtures for intergration tests.
The fixtures for testing `counterfeit` promises have been added. These fixtures consist of a module called `starWars`, that includes the following classes: * DeflectorShield * DeathStar The `DeflectorShield` service exposes one public method called `reboot`. This asynchronous operation returns a promise. The `DeathStar` factory exposes a public method called `rebootDeflectorShield`. This operation delegates to `DeflectorShield#reboot` and interfaces with the promise that is returned.
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function(expect, describe, it, angular, sinon) { | ||
"use strict"; | ||
|
||
var starWars = angular.module("starWars", ["ngResource"]); | ||
|
||
starWars.service('DeflectorShield', function($resource) { | ||
return $resource({}, null, { | ||
"reboot": { | ||
method: "PUT", | ||
url: "/starwars/deflector_shield/reboot" | ||
} | ||
}); | ||
}); | ||
|
||
starWars.factory('DeathStar', function(DeflectorShield) { | ||
var status, shieldStatus; | ||
|
||
shieldStatus = function(msg) { | ||
status = msg; | ||
}; | ||
|
||
return { | ||
rebootDeflectorShield: function() { | ||
DeflectorShield.reboot().$promise.then( | ||
shieldStatus, shieldStatus, shieldStatus); | ||
}, | ||
|
||
shieldStatus: function() { | ||
return status; | ||
}, | ||
} | ||
}); | ||
|
||
})(chai.expect, describe, it, angular, sinon); |