Skip to content

Commit

Permalink
renamed http_json to service, added index.js and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trescube committed May 5, 2017
1 parent c8e4b28 commit d4581b7
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
service: require('./service'),
ServiceConfiguration: require('./ServiceConfiguration')
};
File renamed without changes.
11 changes: 11 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
28 changes: 14 additions & 14 deletions test/http_json.js → test/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand All @@ -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();

});
Expand All @@ -42,7 +42,7 @@ tape('do-nothing service tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -76,7 +76,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -113,7 +113,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -169,7 +169,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -220,7 +220,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -276,7 +276,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -327,7 +327,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -384,7 +384,7 @@ tape('failure conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -439,7 +439,7 @@ tape('success conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -487,7 +487,7 @@ tape('success conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down Expand Up @@ -549,7 +549,7 @@ tape('success conditions tests', (test) => {
}
};

const service = proxyquire('../http_json', {
const service = proxyquire('../service', {
'pelias-logger': logger
})(new MockServiceConfig());

Expand Down
3 changes: 2 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require ('./http_json.js');
require ('./index.js');
require ('./service.js');
require ('./ServiceConfiguration.js');

0 comments on commit d4581b7

Please sign in to comment.