Use Prettier JS (#5017)

* Adds prettier

* Run lint before tests
This commit is contained in:
Florent Vilmart
2018-09-01 13:58:06 -04:00
committed by GitHub
parent 189cd259ee
commit d83a0b6808
240 changed files with 41098 additions and 29020 deletions

View File

@@ -1,28 +1,29 @@
const AdaptableController = require("../lib/Controllers/AdaptableController").AdaptableController;
const FilesAdapter = require("../lib/Adapters/Files/FilesAdapter").default;
const FilesController = require("../lib/Controllers/FilesController").FilesController;
const AdaptableController = require('../lib/Controllers/AdaptableController')
.AdaptableController;
const FilesAdapter = require('../lib/Adapters/Files/FilesAdapter').default;
const FilesController = require('../lib/Controllers/FilesController')
.FilesController;
const MockController = function(options) {
AdaptableController.call(this, options);
}
};
MockController.prototype = Object.create(AdaptableController.prototype);
MockController.prototype.constructor = AdaptableController;
describe("AdaptableController", ()=>{
it("should use the provided adapter", (done) => {
describe('AdaptableController', () => {
it('should use the provided adapter', done => {
const adapter = new FilesAdapter();
const controller = new FilesController(adapter);
expect(controller.adapter).toBe(adapter);
// make sure _adapter is private
expect(controller._adapter).toBe(undefined);
// Override _adapter is not doing anything
controller._adapter = "Hello";
controller._adapter = 'Hello';
expect(controller.adapter).toBe(adapter);
done();
});
it("should throw when creating a new mock controller", (done) => {
it('should throw when creating a new mock controller', done => {
const adapter = new FilesAdapter();
expect(() => {
new MockController(adapter);
@@ -30,7 +31,7 @@ describe("AdaptableController", ()=>{
done();
});
it("should fail setting the wrong adapter to the controller", (done) => {
it('should fail setting the wrong adapter to the controller', done => {
function WrongAdapter() {}
const adapter = new FilesAdapter();
const controller = new FilesController(adapter);
@@ -41,7 +42,7 @@ describe("AdaptableController", ()=>{
done();
});
it("should fail to instantiate a controller with wrong adapter", (done) => {
it('should fail to instantiate a controller with wrong adapter', done => {
function WrongAdapter() {}
const adapter = new WrongAdapter();
expect(() => {
@@ -50,32 +51,32 @@ describe("AdaptableController", ()=>{
done();
});
it("should fail to instantiate a controller without an adapter", (done) => {
it('should fail to instantiate a controller without an adapter', done => {
expect(() => {
new FilesController();
}).toThrow();
done();
});
it("should accept an object adapter", (done) => {
it('should accept an object adapter', done => {
const adapter = {
createFile: function() { },
deleteFile: function() { },
getFileData: function() { },
getFileLocation: function() { },
}
createFile: function() {},
deleteFile: function() {},
getFileData: function() {},
getFileLocation: function() {},
};
expect(() => {
new FilesController(adapter);
}).not.toThrow();
done();
});
it("should accept an prototype based object adapter", (done) => {
it('should accept an prototype based object adapter', done => {
function AGoodAdapter() {}
AGoodAdapter.prototype.createFile = function() { };
AGoodAdapter.prototype.deleteFile = function() { };
AGoodAdapter.prototype.getFileData = function() { };
AGoodAdapter.prototype.getFileLocation = function() { };
AGoodAdapter.prototype.createFile = function() {};
AGoodAdapter.prototype.deleteFile = function() {};
AGoodAdapter.prototype.getFileData = function() {};
AGoodAdapter.prototype.getFileLocation = function() {};
const adapter = new AGoodAdapter();
expect(() => {