|
|
@ -5,7 +5,7 @@ const PointInPolygon = require('../../../../service/configurations/PointInPolygo |
|
|
|
module.exports.tests.all = (test, common) => { |
|
|
|
module.exports.tests.all = (test, common) => { |
|
|
|
test('getName should return \'pip\'', (t) => { |
|
|
|
test('getName should return \'pip\'', (t) => { |
|
|
|
const configBlob = { |
|
|
|
const configBlob = { |
|
|
|
url: 'base url', |
|
|
|
url: 'http://localhost:1234', |
|
|
|
timeout: 17, |
|
|
|
timeout: 17, |
|
|
|
retries: 19 |
|
|
|
retries: 19 |
|
|
|
}; |
|
|
|
}; |
|
|
@ -13,7 +13,7 @@ module.exports.tests.all = (test, common) => { |
|
|
|
const pointInPolygon = new PointInPolygon(configBlob); |
|
|
|
const pointInPolygon = new PointInPolygon(configBlob); |
|
|
|
|
|
|
|
|
|
|
|
t.equals(pointInPolygon.getName(), 'pip'); |
|
|
|
t.equals(pointInPolygon.getName(), 'pip'); |
|
|
|
t.equals(pointInPolygon.getBaseUrl(), 'base url'); |
|
|
|
t.equals(pointInPolygon.getBaseUrl(), 'http://localhost:1234/'); |
|
|
|
t.equals(pointInPolygon.getTimeout(), 17); |
|
|
|
t.equals(pointInPolygon.getTimeout(), 17); |
|
|
|
t.equals(pointInPolygon.getRetries(), 19); |
|
|
|
t.equals(pointInPolygon.getRetries(), 19); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
@ -22,7 +22,7 @@ module.exports.tests.all = (test, common) => { |
|
|
|
|
|
|
|
|
|
|
|
test('getUrl should return value formatted with point.lon/lat passed to constructor', (t) => { |
|
|
|
test('getUrl should return value formatted with point.lon/lat passed to constructor', (t) => { |
|
|
|
const configBlob = { |
|
|
|
const configBlob = { |
|
|
|
url: 'base url' |
|
|
|
url: 'http://localhost:1234' |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const pointInPolygon = new PointInPolygon(configBlob); |
|
|
|
const pointInPolygon = new PointInPolygon(configBlob); |
|
|
@ -34,14 +34,14 @@ module.exports.tests.all = (test, common) => { |
|
|
|
req.clean['point.lon'] = 21.212121; |
|
|
|
req.clean['point.lon'] = 21.212121; |
|
|
|
req.clean['point.lat'] = 12.121212; |
|
|
|
req.clean['point.lat'] = 12.121212; |
|
|
|
|
|
|
|
|
|
|
|
t.equals(pointInPolygon.getUrl(req), 'base url/21.212121/12.121212'); |
|
|
|
t.equals(pointInPolygon.getUrl(req), 'http://localhost:1234/21.212121/12.121212'); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('getHeaders should return an empty object', (t) => { |
|
|
|
test('getHeaders should return an empty object', (t) => { |
|
|
|
const configBlob = { |
|
|
|
const configBlob = { |
|
|
|
url: 'base url', |
|
|
|
url: 'http://localhost:1234', |
|
|
|
timeout: 17, |
|
|
|
timeout: 17, |
|
|
|
retries: 19 |
|
|
|
retries: 19 |
|
|
|
}; |
|
|
|
}; |
|
|
@ -55,7 +55,7 @@ module.exports.tests.all = (test, common) => { |
|
|
|
|
|
|
|
|
|
|
|
test('getParameters should return an empty object', (t) => { |
|
|
|
test('getParameters should return an empty object', (t) => { |
|
|
|
const configBlob = { |
|
|
|
const configBlob = { |
|
|
|
url: 'base url', |
|
|
|
url: 'http://localhost:1234', |
|
|
|
timeout: 17, |
|
|
|
timeout: 17, |
|
|
|
retries: 19 |
|
|
|
retries: 19 |
|
|
|
}; |
|
|
|
}; |
|
|
@ -67,6 +67,27 @@ module.exports.tests.all = (test, common) => { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('baseUrl ending in / should not have double /\'s return by getUrl', (t) => { |
|
|
|
|
|
|
|
const configBlob = { |
|
|
|
|
|
|
|
url: 'http://localhost:1234/', |
|
|
|
|
|
|
|
timeout: 17, |
|
|
|
|
|
|
|
retries: 19 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const pointInPolygon = new PointInPolygon(configBlob); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
|
|
|
clean: { } |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
req.clean['point.lon'] = 21.212121; |
|
|
|
|
|
|
|
req.clean['point.lat'] = 12.121212; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.equals(pointInPolygon.getUrl(req), 'http://localhost:1234/21.212121/12.121212'); |
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
module.exports.all = (tape, common) => { |
|
|
|
module.exports.all = (tape, common) => { |
|
|
|