From 822019f12a80a3756038ab50e8433f375f7c0e36 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 15 Apr 2016 16:51:38 -0700 Subject: [PATCH] change test structure, create elasticsearch fixture --- package.json | 2 +- test/fixtures/elasticsearch.js | 6 ++++++ test/{ => src}/helpers/create_client.js | 7 ++----- test/{ => src}/index.js | 7 ++++++- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/elasticsearch.js rename test/{ => src}/helpers/create_client.js (78%) rename test/{ => src}/index.js (89%) diff --git a/package.json b/package.json index 34b5fe5..b12d921 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "lib/index.js", "scripts": { - "test": "npm run build && mocha --compilers js:babel-core/register test/**", + "test": "npm run build && mocha --compilers js:babel-core/register test/src/**", "build": "babel src --out-dir lib", "prepublish": "npm run test" }, diff --git a/test/fixtures/elasticsearch.js b/test/fixtures/elasticsearch.js new file mode 100644 index 0000000..a819029 --- /dev/null +++ b/test/fixtures/elasticsearch.js @@ -0,0 +1,6 @@ +function Client() {} +Client.prototype.index = function () {}; + +export default { + Client: Client +}; diff --git a/test/helpers/create_client.js b/test/src/helpers/create_client.js similarity index 78% rename from test/helpers/create_client.js rename to test/src/helpers/create_client.js index 11a94e0..fc0b7a1 100644 --- a/test/helpers/create_client.js +++ b/test/src/helpers/create_client.js @@ -1,11 +1,8 @@ import expect from 'expect.js'; import proxyquire from 'proxyquire'; +import * as elasticsearchMock from '../../fixtures/elasticsearch'; -const elasticsearchMock = { - Client: function Client() {} -}; - -const createClient = proxyquire.noPreserveCache()('../../lib/helpers/create_client', { +const createClient = proxyquire.noPreserveCache()('../../../lib/helpers/create_client', { elasticsearch: elasticsearchMock }); diff --git a/test/index.js b/test/src/index.js similarity index 89% rename from test/index.js rename to test/src/index.js index f75e46c..9469d89 100644 --- a/test/index.js +++ b/test/src/index.js @@ -1,4 +1,4 @@ -import Elastique from '../lib/index'; +import Elastique from '../../lib/index'; import expect from 'expect.js'; describe('Elastique class', function () { @@ -24,4 +24,9 @@ describe('Elastique class', function () { expect(init).to.throwException(/invalid.+protocol/i); }); }); + + describe('Job Creation', function () { + + }); + }); \ No newline at end of file