Use standard and prettier (#10)
* switch from custom eslint config to standard + prettier * fix new standard eslint violations * add editorconfig file * auto-fix all other violations * update lint yarn script * remove jshint comment
This commit is contained in:
53
test/unit/browser_builds/angular.js
vendored
53
test/unit/browser_builds/angular.js
vendored
@ -3,8 +3,8 @@ var _ = require('lodash');
|
||||
var expect = require('expect.js');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
describe('Angular esFactory', function () {
|
||||
before(function () {
|
||||
describe('Angular esFactory', function() {
|
||||
before(function() {
|
||||
require('../../../src/elasticsearch.angular.js');
|
||||
});
|
||||
|
||||
@ -12,18 +12,18 @@ describe('Angular esFactory', function () {
|
||||
var $rootScope;
|
||||
|
||||
function bootstrap(env) {
|
||||
beforeEach(function () {
|
||||
beforeEach(function() {
|
||||
var promiseProvider = _.noop;
|
||||
if (env.bluebirdPromises) {
|
||||
promiseProvider = function ($provide) {
|
||||
$provide.service('$q', function () {
|
||||
promiseProvider = function($provide) {
|
||||
$provide.service('$q', function() {
|
||||
return {
|
||||
defer: function () {
|
||||
defer: function() {
|
||||
return _.bindAll(Promise.defer(), ['resolve', 'reject']);
|
||||
},
|
||||
reject: Promise.reject,
|
||||
when: Promise.resolve,
|
||||
all: Promise.all
|
||||
all: Promise.all,
|
||||
};
|
||||
});
|
||||
};
|
||||
@ -32,29 +32,31 @@ describe('Angular esFactory', function () {
|
||||
angular.mock.module(promiseProvider, 'elasticsearch');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject(function ($injector) {
|
||||
esFactory = $injector.get('esFactory');
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
}));
|
||||
beforeEach(
|
||||
angular.mock.inject(function($injector) {
|
||||
esFactory = $injector.get('esFactory');
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
describe('basic', function () {
|
||||
describe('basic', function() {
|
||||
bootstrap({
|
||||
bluebirdPromises: true
|
||||
bluebirdPromises: true,
|
||||
});
|
||||
|
||||
it('is available in the elasticsearch module', function () {
|
||||
it('is available in the elasticsearch module', function() {
|
||||
expect(esFactory).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has Transport and ConnectionPool properties', function () {
|
||||
it('has Transport and ConnectionPool properties', function() {
|
||||
expect(esFactory).to.have.property('Transport');
|
||||
expect(esFactory).to.have.property('ConnectionPool');
|
||||
});
|
||||
|
||||
it('returns a new client when it is called', function () {
|
||||
it('returns a new client when it is called', function() {
|
||||
var client = esFactory({
|
||||
hosts: null
|
||||
hosts: null,
|
||||
});
|
||||
|
||||
expect(client).to.have.keys('transport');
|
||||
@ -62,15 +64,18 @@ describe('Angular esFactory', function () {
|
||||
client.close();
|
||||
});
|
||||
|
||||
it('returns an error created by calling a method incorrectly', function () {
|
||||
it('returns an error created by calling a method incorrectly', function() {
|
||||
var client = esFactory({ hosts: null });
|
||||
|
||||
var prom = client.get().then(function () {
|
||||
throw new Error('expected request to fail');
|
||||
}, function (err) {
|
||||
expect(err).to.have.property('message');
|
||||
expect(err.message).to.match(/unable/i);
|
||||
});
|
||||
var prom = client.get().then(
|
||||
function() {
|
||||
throw new Error('expected request to fail');
|
||||
},
|
||||
function(err) {
|
||||
expect(err).to.have.property('message');
|
||||
expect(err.message).to.match(/unable/i);
|
||||
}
|
||||
);
|
||||
|
||||
$rootScope.$apply();
|
||||
return prom;
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
var expect = require('expect.js');
|
||||
|
||||
describe('elasticsearch namespace', function () {
|
||||
describe('elasticsearch namespace', function() {
|
||||
var es = window.elasticsearch;
|
||||
it('is defined on the window', function () {
|
||||
it('is defined on the window', function() {
|
||||
expect(es).to.be.ok();
|
||||
});
|
||||
|
||||
it('has Client, ConnectionPool, Transport, and errors keys', function () {
|
||||
it('has Client, ConnectionPool, Transport, and errors keys', function() {
|
||||
expect(es).to.have.keys('Client', 'ConnectionPool', 'Transport', 'errors');
|
||||
});
|
||||
|
||||
it('can create a client', function () {
|
||||
it('can create a client', function() {
|
||||
var client = new es.Client({ hosts: null });
|
||||
expect(client).to.have.keys('transport');
|
||||
expect(client.transport).to.be.a(es.Transport);
|
||||
|
||||
15
test/unit/browser_builds/jquery.js
vendored
15
test/unit/browser_builds/jquery.js
vendored
@ -1,16 +1,21 @@
|
||||
/* global $ */
|
||||
var expect = require('expect.js');
|
||||
|
||||
describe('jQuery.es namespace', function () {
|
||||
it('is defined on the global jQuery', function () {
|
||||
describe('jQuery.es namespace', function() {
|
||||
it('is defined on the global jQuery', function() {
|
||||
expect($.es).to.be.ok();
|
||||
});
|
||||
|
||||
it('has Client, ConnectionPool, Transport, and errors keys', function () {
|
||||
expect($.es).to.have.keys('Client', 'ConnectionPool', 'Transport', 'errors');
|
||||
it('has Client, ConnectionPool, Transport, and errors keys', function() {
|
||||
expect($.es).to.have.keys(
|
||||
'Client',
|
||||
'ConnectionPool',
|
||||
'Transport',
|
||||
'errors'
|
||||
);
|
||||
});
|
||||
|
||||
it('can create a client', function () {
|
||||
it('can create a client', function() {
|
||||
var client = new $.es.Client({ hosts: null });
|
||||
expect(client).to.have.keys('transport');
|
||||
expect(client.transport).to.be.a($.es.Transport);
|
||||
|
||||
Reference in New Issue
Block a user