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.
35 lines
940 B
35 lines
940 B
window.assert = chai.assert;
|
|
|
|
describe('SimpleService', function () {
|
|
// define variables for the services we want to access in tests
|
|
var SimpleService,
|
|
$log;
|
|
|
|
beforeEach(function () {
|
|
// load the module we want to test
|
|
module('app');
|
|
|
|
// inject the services we want to test
|
|
inject(function (_SimpleService_, _$log_) {
|
|
SimpleService = _SimpleService_;
|
|
$log = _$log_;
|
|
})
|
|
});
|
|
|
|
describe('#DoSomething', function () {
|
|
it('should log the message "something done!"', function () {
|
|
// Arrange
|
|
sinon.spy($log, 'info');
|
|
|
|
// Act
|
|
SimpleService.DoSomething();
|
|
|
|
// Assert
|
|
assert($log.info.calledOnce);
|
|
assert($log.info.calledWith('something done!'));
|
|
|
|
// Cleanup
|
|
$log.info.restore();
|
|
});
|
|
});
|
|
});
|