Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
saharj committed Mar 30, 2016
1 parent 55c3aa9 commit c3f5258
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: 'google'
};
};
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
"worker-loader": "^0.7.0",
"yaml-js": "^0.1.3"
},
"eslintConfig": {
"globals": {
"window": true
},
"env": {
"browser": true
}
},
"engines": {
"node": ">=5.8.0"
},
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

module.exports = {
extends: "../.eslintrc.js",
globals: {
sinon: true,
inject: true,
window: true
},
env: {
jasmine: true,
mocha: true
Expand Down
7 changes: 6 additions & 1 deletion test/e2e/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
module.exports = {
extends: '../.eslintrc.js',
globals: {
$: true
$: true,
window: true,
browser: true
},
env: {
"browser": true
}
}
2 changes: 1 addition & 1 deletion test/e2e/protractor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var config = {
});
},

afterLaunch: function(exitCode) {
afterLaunch: function() {
console.log('Killing the web server at port ', PORT);

if (server) {
Expand Down
11 changes: 5 additions & 6 deletions test/e2e/specs/3_rendering_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ describe('Rendering', function() {
['At least a model', '.schema-model']
];

elements.forEach(function(element) {
expectElement(element[0], element[1]);
});

function expectElement(name, selector) {
var expectElement = function(name, selector) {
it('should render ' + name, function() {
expect($(selector).isPresent()).toBe(true);
});
}
};
elements.forEach(function(element) {
expectElement(element[0], element[1]);
});
});
5 changes: 2 additions & 3 deletions test/e2e/specs/4_errors_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Test errors that is being presented to user
*/

function setValue(value) {
var setValue = function(value) {
browser.executeScript(function(value) {
document.querySelector('[ui-ace]').env.editor.setValue(value);
}, value);
browser.sleep(500);
}
};

describe('Error Presenter', function() {
it('should show an error when document is empty', function() {
Expand Down Expand Up @@ -70,5 +70,4 @@ describe('Error Presenter', function() {
expect($('.error-header h4').getText()).toContain('Warning');
}
);

});
7 changes: 3 additions & 4 deletions test/e2e/specs/5_session_auth_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ var path = require('path');
var yamlPath = path.join(__dirname, './session.yaml');
var swyaml = fs.readFileSync(yamlPath).toString();

function setValue(value) {
var setValue = function(value) {
browser.executeScript(function(value) {
document.querySelector('[ui-ace]').env.editor.setValue(value);
}, value);
browser.sleep(1000);
}
};

describe('Session auth tests', function() {
beforeEach(function() {
Expand All @@ -26,7 +26,7 @@ describe('Session auth tests', function() {
});
});

// TODO: Fix tests
// Fix tests (to do)
it('Should find the sessionStorage', function() {
// swyaml is the test yaml file
setValue(swyaml);
Expand All @@ -40,6 +40,5 @@ describe('Session auth tests', function() {
expect(storeAuth.hasOwnProperty('internalApiKey')).toEqual(true);
expect(storeAuth.hasOwnProperty('anynotfound')).toEqual(false);
});

});
});
2 changes: 1 addition & 1 deletion test/unit/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

SwaggerEditor.config(function ($provide) {
SwaggerEditor.config(function($provide) {
$provide.constant('defaults', {
disableCodeGen: true,
examplesFolder: 'spec-files/',
Expand Down
5 changes: 2 additions & 3 deletions test/unit/spec/controllers/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ describe('Controller: EditorCtrl', function() {
// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var EditorCtrl;
var scope;

// Initialize the controller and a mock scope
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
EditorCtrl = $controller('EditorCtrl', {
$controller('EditorCtrl', {
$scope: scope
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
6 changes: 2 additions & 4 deletions test/unit/spec/controllers/errorpresenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
var angular = require('angular');

describe('Controller: ErrorPresenterCtrl', function() {

// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var ErrorPresenterCtrl;
var scope;

// Initialize the controller and a mock scope
Expand All @@ -17,13 +15,13 @@ describe('Controller: ErrorPresenterCtrl', function() {
rootScope.warnings = [];
rootScope.errors = [];

ErrorPresenterCtrl = $controller('ErrorPresenterCtrl', {
$controller('ErrorPresenterCtrl', {
$scope: scope,
$rootScope: rootScope
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
5 changes: 2 additions & 3 deletions test/unit/spec/controllers/file-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('Controller: FileImportCtrl', function() {
// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var FileImportCtrl;
var modalInstance;
var scope;

Expand All @@ -21,13 +20,13 @@ describe('Controller: FileImportCtrl', function() {
then: callback
}
};
FileImportCtrl = $controller('FileImportCtrl', {
$controller('FileImportCtrl', {
$scope: scope,
$uibModalInstance: modalInstance
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
6 changes: 2 additions & 4 deletions test/unit/spec/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
var angular = require('angular');

describe('Controller: MainCtrl', function() {

// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var MainCtrl;
var scope;

// Initialize the controller and a mock scope
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$controller('MainCtrl', {
$scope: scope
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
8 changes: 2 additions & 6 deletions test/unit/spec/controllers/openexamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
var angular = require('angular');

describe('Controller: OpenExamplesCtrl', function() {

// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var OpenExamplesCtrl;
var FileLoader;
var $uibModalInstance;
var scope;
Expand All @@ -26,8 +24,6 @@ describe('Controller: OpenExamplesCtrl', function() {
}
};

var loadFromUrlCallback = sinon.spy();

FileLoader = {
loadFromUrl: function() {
return {
Expand All @@ -36,15 +32,15 @@ describe('Controller: OpenExamplesCtrl', function() {
}
};

OpenExamplesCtrl = $controller('OpenExamplesCtrl', {
$controller('OpenExamplesCtrl', {
$scope: scope,
$uibModalInstance: $uibModalInstance,
FileLoader: FileLoader
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});

it('should select first example as selected file by default', function() {
Expand Down
5 changes: 2 additions & 3 deletions test/unit/spec/controllers/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ describe('Controller: PreviewCtrl', function() {
// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var PreviewCtrl;
var scope;

// Initialize the controller and a mock scope
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
PreviewCtrl = $controller('PreviewCtrl', {
$controller('PreviewCtrl', {
$scope: scope
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
1 change: 0 additions & 1 deletion test/unit/spec/controllers/tryoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var angular = require('angular');

describe('Directive: tryOperation', function() {

// load the directive's module
beforeEach(angular.mock.module('SwaggerEditor'));

Expand Down
6 changes: 2 additions & 4 deletions test/unit/spec/controllers/url-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
var angular = require('angular');

describe('Controller: UrlImportCtrl', function() {

// load the controller's module
beforeEach(angular.mock.module('SwaggerEditor'));

var UrlImportCtrl;
var $uibModalInstance;
var scope;

Expand All @@ -24,13 +22,13 @@ describe('Controller: UrlImportCtrl', function() {
then: callback
}
};
UrlImportCtrl = $controller('UrlImportCtrl', {
$controller('UrlImportCtrl', {
$scope: scope,
$uibModalInstance: $uibModalInstance
});
}));

it('should have a scope', function() {
expect(!!scope).to.equal(true);
expect(Boolean(scope)).to.equal(true);
});
});
1 change: 0 additions & 1 deletion test/unit/spec/directives/collapsewhen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var angular = require('angular');

describe('Directive: collapseWhen', function() {

// load the directive's module
beforeEach(angular.mock.module('SwaggerEditor'));

Expand Down
1 change: 0 additions & 1 deletion test/unit/spec/directives/schemamodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var angular = require('angular');

describe('Directive: schemaModel', function() {

// load the directive's module
beforeEach(angular.mock.module('SwaggerEditor'));

Expand Down
5 changes: 2 additions & 3 deletions test/unit/spec/services/ast-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var angular = require('angular');

describe('Service: ASTManager', function() {

var yaml;

// load the service's module
Expand All @@ -18,7 +17,7 @@ describe('Service: ASTManager', function() {
}));

describe('#pathForPosition', function() {
describe('out of range', function(done) {
describe('out of range', function() {
it('returns empty array for out of range row', function(done) {
var position = {line: 3, column: 0};

Expand Down Expand Up @@ -47,7 +46,7 @@ describe('Service: ASTManager', function() {
yaml = 'swagger: 2.0';
});

// TODO: test edges
// test edges (to do)

it('should return empty array when pointer is at middle of the hash key',
function(done) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/spec/services/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ describe('Service: Backend', function() {
}));

it('should exists', function() {
expect(!!Backend).to.equal(true);
expect(Boolean(Backend)).to.equal(true);
});
});
2 changes: 1 addition & 1 deletion test/unit/spec/services/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ describe('Service: Builder', function() {
}));

it('should exists', function() {
expect(!!Builder).to.equal(true);
expect(Boolean(Builder)).to.equal(true);
});
});
2 changes: 1 addition & 1 deletion test/unit/spec/services/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ describe('Service: Editor', function() {
}));

it('should exists', function() {
expect(!!Editor).to.equal(true);
expect(Boolean(Editor)).to.equal(true);
});
});
Loading

0 comments on commit c3f5258

Please sign in to comment.