chore(test) fix jshint errors in spec file · mgonto/restangular@1a988cb
1+/* global describe, beforeEach, inject, afterEach, it, expect, spyOn */
2+/* jshint unused: false */
13describe('Restangular', function() {
24// API
3-var Restangular, $httpBackend;
4-var accountsModel, restangularAccounts, restangularAccount0, restangularAccount1;
5-var accountsHalModel;
6-var messages, newAccount, nextAccountId;
5+var Restangular, $httpBackend,
6+accountsModel, restangularAccounts, restangularAccount0, restangularAccount1,
7+infoModel, accountsDoSomethingModel, customers, publications, newCustomer,
8+accountsHalModel,
9+messages, newAccount, nextAccountId;
710811// Load required modules
912beforeEach(angular.mock.module('restangular'));
@@ -873,7 +876,7 @@ describe('Restangular', function() {
873876}).then(function(accountFromServer2) {
874877expect(accountFromServer2.route).toBe(account1.route);
875878});
876-$httpBackend.flush()
879+$httpBackend.flush();
877880});
878881879882it('Should make RequestLess connections with one', function() {
@@ -1018,7 +1021,7 @@ describe('Restangular', function() {
10181021});
1019102210201023it('should allow for a custom method to be placed at the model level when several models are requested', function() {
1021-var accountPromise;
1024+var accountsPromise;
1022102510231026Restangular.addElementTransformer('accounts', false, function(model) {
10241027model.prettifyAmount = function() {};
@@ -1028,16 +1031,16 @@ describe('Restangular', function() {
10281031accountsPromise = Restangular.all('accounts', 1).getList();
1029103210301033accountsPromise.then(function(accounts) {
1031-accounts.forEach(function(account, index) {
1034+accounts.forEach(function(account) {
10321035expect(typeof account.prettifyAmount).toEqual('function');
10331036});
10341037});
1035103810361039$httpBackend.flush();
10371040});
103810411039-it("should allow for a custom method to be placed at the collection level using a regexp matching the route", function() {
1040-var accountPromise;
1042+it('should allow for a custom method to be placed at the collection level using a regexp matching the route', function() {
1043+var accountsPromise;
1041104410421045Restangular.addElementTransformer(/^accounts/, false, function(model) {
10431046model.prettifyAmount = function() {};
@@ -1047,15 +1050,15 @@ describe('Restangular', function() {
10471050accountsPromise = Restangular.all('accounts/search/byOwner', 1).getList();
1048105110491052accountsPromise.then(function(accounts) {
1050-accounts.forEach(function(account, index) {
1051-expect(typeof account.prettifyAmount).toEqual("function");
1053+accounts.forEach(function(account) {
1054+expect(typeof account.prettifyAmount).toEqual('function');
10521055});
10531056});
1054105710551058$httpBackend.flush();
10561059});
105710601058-it("should allow for a custom method to be placed at the model level using regexp route when one model is requested", function() {
1061+it('should allow for a custom method to be placed at the model level using regexp route when one model is requested', function() {
10591062var accountPromise;
1060106310611064Restangular.addElementTransformer(/^accounts/, false, function(model) {
@@ -1066,14 +1069,14 @@ describe('Restangular', function() {
10661069accountPromise = Restangular.one('accounts', 1).get();
1067107010681071accountPromise.then(function(account) {
1069-expect(typeof account.prettifyAmount).toEqual("function");
1072+expect(typeof account.prettifyAmount).toEqual('function');
10701073});
1071107410721075$httpBackend.flush();
10731076});
107410771075-it("should allow for a custom method to be placed at the model level using regexp when several models are requested", function() {
1076-var accountPromise;
1078+it('should allow for a custom method to be placed at the model level using regexp when several models are requested', function() {
1079+var accountsPromise;
1077108010781081Restangular.addElementTransformer(/^accounts/, false, function(model) {
10791082model.prettifyAmount = function() {};
@@ -1083,8 +1086,8 @@ describe('Restangular', function() {
10831086accountsPromise = Restangular.all('accounts', 1).getList();
1084108710851088accountsPromise.then(function(accounts) {
1086-accounts.forEach(function(account, index) {
1087-expect(typeof account.prettifyAmount).toEqual("function");
1089+accounts.forEach(function(account) {
1090+expect(typeof account.prettifyAmount).toEqual('function');
10881091});
10891092});
10901093@@ -1244,7 +1247,7 @@ describe('Restangular', function() {
12441247});
1245124812461249it('getRestangularUrl() returns still the url without id after GET', function() {
1247-record = Restangular.one('info', 0, true);
1250+var record = Restangular.one('info', 0, true);
12481251record.get().then(function(data) {
12491252expect(data.getRestangularUrl()).toEqual('/info');
12501253});