You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
describe('SimpleController', function () {
|
|
// define variables for the services we want to access in tests
|
|
var SimpleController,
|
|
SimpleService;
|
|
|
|
beforeEach(function () {
|
|
// load the module we want to test
|
|
module('app');
|
|
|
|
// get services from injector
|
|
inject(function ($controller, _SimpleService_) {
|
|
SimpleService = _SimpleService_;
|
|
|
|
// spy on service method to check if it gets called later
|
|
sinon.spy(SimpleService, 'DoSomething');
|
|
|
|
// get controller instance from $controller service
|
|
SimpleController = $controller('SimpleController');
|
|
});
|
|
});
|
|
|
|
afterEach(function(){
|
|
// remove spy from service
|
|
SimpleService.DoSomething.restore();
|
|
});
|
|
|
|
describe('constructor', function () {
|
|
it('should do something with the SimpleService', function () {
|
|
// Assert
|
|
assert(SimpleService.DoSomething.calledOnce);
|
|
});
|
|
});
|
|
});
|