Skip to content

Commit

Permalink
update tests to es6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemmarsh committed Mar 1, 2016
1 parent 65c3134 commit 92dc04a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/unit/constants_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

describe('Unit: Constants', function() {

var constants;
let constants;

beforeEach(function() {
// instantiate the app module
angular.mock.module('app');

// mock the directive
angular.mock.inject(function(AppSettings) {
angular.mock.inject((AppSettings) => {
constants = AppSettings;
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/controllers/example_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

describe('Unit: ExampleCtrl', function() {

var ctrl;
let ctrl;

beforeEach(function() {
// instantiate the app module
angular.mock.module('app');

angular.mock.inject(function($controller) {
angular.mock.inject(($controller) => {
ctrl = $controller('ExampleCtrl');
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/directives/example_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Unit: ExampleDirective', function() {
spyOn(window, 'alert');
angular.mock.module('app');

angular.mock.inject(function($compile, $rootScope) {
angular.mock.inject(($compile, $rootScope) => {
scope = $rootScope;
scope.title = 'A sample title';
scope.message = 'A sample message';
Expand Down
8 changes: 4 additions & 4 deletions test/unit/filters/example_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

describe('Unit: ExampleFilter', function() {

var $filter;
let $filter;

beforeEach(function() {
// instantiate the app module
angular.mock.module('app');

// mock the filter
angular.mock.inject(function(_$filter_) {
angular.mock.inject((_$filter_) => {
$filter = _$filter_;
});
});

it('should replace the word "keyboard" with "leopard"', function() {
var testString = 'computers are operated by keyboards';
var resultString = $filter('ExampleFilter')(testString);
const testString = 'computers are operated by keyboards';
const resultString = $filter('ExampleFilter')(testString);

expect(resultString).toEqual('computers are operated by leopards');
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/services/example_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

describe('Unit: ExampleService', function() {

var http, service;
let http, service;

beforeEach(function() {
// instantiate the app module
angular.mock.module('app');

// mock the service
angular.mock.inject(function($httpBackend, ExampleService) {
angular.mock.inject(($httpBackend, ExampleService) => {
http = $httpBackend;
service = ExampleService;
});
Expand All @@ -24,9 +24,9 @@ describe('Unit: ExampleService', function() {
it('should retrieve data', function(done) {
http.expect('GET', 'apiPath').respond(201, {data: 1234});

service.get().then(function(result) {
service.get().then((result) => {
expect(result).toEqual({data: 1234});
}, function(error) {
}).catch((error) => {
expect(error).toBeUndefined();
}).then(done);

Expand Down

0 comments on commit 92dc04a

Please sign in to comment.