diff --git a/index.js b/index.js new file mode 100644 index 0000000..2253e27 --- /dev/null +++ b/index.js @@ -0,0 +1,4 @@ +module.exports = { + service: require('./service'), + ServiceConfiguration: require('./ServiceConfiguration') +}; diff --git a/http_json.js b/service.js similarity index 100% rename from http_json.js rename to service.js diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..09d5578 --- /dev/null +++ b/test/index.js @@ -0,0 +1,11 @@ +const tape = require('tape'); +const index = require('../index'); + +tape('index tests', (test) => { + test.test('', (t) => { + t.equals(typeof index.service, 'function'); + t.equals(index.service.length, 1); + t.equals(typeof index.ServiceConfiguration, 'function'); + t.end(); + }); +}); diff --git a/test/http_json.js b/test/service.js similarity index 95% rename from test/http_json.js rename to test/service.js index 5cd6957..300aa5c 100644 --- a/test/http_json.js +++ b/test/service.js @@ -10,7 +10,7 @@ tape('service tests', (test) => { test.test('valid interface', (t) => { const logger = require('pelias-mock-logger')(); - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger }); @@ -23,9 +23,9 @@ tape('service tests', (test) => { tape('conforms_to tests', (test) => { test.test('non-ServiceConfiguration instance should throw error', (t) => { const serviceConfig = 'not an instance of serviceConfiguration'; - const http_json = require('../http_json'); + const service = require('../service'); - t.throws(http_json.bind(null, serviceConfig), /serviceConfig should be an instance of ServiceConfiguration/); + t.throws(service.bind(null, serviceConfig), /serviceConfig should be an instance of ServiceConfiguration/); t.end(); }); @@ -42,7 +42,7 @@ tape('do-nothing service tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -76,7 +76,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -113,7 +113,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -169,7 +169,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -220,7 +220,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -276,7 +276,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -327,7 +327,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -384,7 +384,7 @@ tape('failure conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -439,7 +439,7 @@ tape('success conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -487,7 +487,7 @@ tape('success conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); @@ -549,7 +549,7 @@ tape('success conditions tests', (test) => { } }; - const service = proxyquire('../http_json', { + const service = proxyquire('../service', { 'pelias-logger': logger })(new MockServiceConfig()); diff --git a/test/test.js b/test/test.js index fc00f6a..91713d3 100644 --- a/test/test.js +++ b/test/test.js @@ -1,2 +1,3 @@ -require ('./http_json.js'); +require ('./index.js'); +require ('./service.js'); require ('./ServiceConfiguration.js');