Browse Source

Rename doc endpoint to place

pull/204/head
Julian Simioni 9 years ago committed by Julian Simioni
parent
commit
167547a6c1
  1. 8
      app.js
  2. 4
      test/ciao/place/msuccess.coffee
  3. 4
      test/ciao/place/success.coffee
  4. 4
      test/unit/controller/place.js
  5. 4
      test/unit/run.js
  6. 8
      test/unit/sanitiser/place.js

8
app.js

@ -15,7 +15,7 @@ app.use( require('./middleware/jsonp') );
/** ----------------------- sanitisers ----------------------- **/ /** ----------------------- sanitisers ----------------------- **/
var sanitisers = {}; var sanitisers = {};
sanitisers.doc = require('./sanitiser/doc'); sanitisers.place = require('./sanitiser/place');
sanitisers.suggest = require('./sanitiser/suggest'); sanitisers.suggest = require('./sanitiser/suggest');
sanitisers.search = require('./sanitiser/search'); sanitisers.search = require('./sanitiser/search');
sanitisers.coarse = require('./sanitiser/coarse'); sanitisers.coarse = require('./sanitiser/coarse');
@ -25,7 +25,7 @@ sanitisers.reverse = require('./sanitiser/reverse');
var controllers = {}; var controllers = {};
controllers.index = require('./controller/index'); controllers.index = require('./controller/index');
controllers.doc = require('./controller/doc'); controllers.place = require('./controller/place');
controllers.search = require('./controller/search'); controllers.search = require('./controller/search');
/** ----------------------- routes ----------------------- **/ /** ----------------------- routes ----------------------- **/
@ -33,8 +33,8 @@ controllers.search = require('./controller/search');
// api root // api root
app.get( '/', controllers.index() ); app.get( '/', controllers.index() );
// doc API // place API
app.get( '/doc', sanitisers.doc.middleware, controllers.doc() ); app.get( '/place', sanitisers.place.middleware, controllers.place() );
// suggest APIs // suggest APIs
app.get( '/suggest', sanitisers.search.middleware, controllers.search() ); app.get( '/suggest', sanitisers.search.middleware, controllers.search() );

4
test/ciao/place/msuccess.coffee

@ -1,6 +1,6 @@
#> valid doc query #> valid place query
path: '/doc?id=geoname:4221195&id=geoname:4193595' path: '/place?id=geoname:4221195&id=geoname:4193595'
#? 200 ok #? 200 ok
response.statusCode.should.equal 200 response.statusCode.should.equal 200

4
test/ciao/place/success.coffee

@ -1,6 +1,6 @@
#> valid doc query #> valid place query
path: '/doc?id=geoname:4221195' path: '/place?id=geoname:4221195'
#? 200 ok #? 200 ok
response.statusCode.should.equal 200 response.statusCode.should.equal 200

4
test/unit/controller/place.js

@ -1,4 +1,4 @@
var setup = require('../../../controller/doc'), var setup = require('../../../controller/place'),
mockBackend = require('../mock/backend'); mockBackend = require('../mock/backend');
module.exports.tests = {}; module.exports.tests = {};
@ -14,7 +14,7 @@ module.exports.tests.interface = function(test, common) {
// functionally test controller (backend success) // functionally test controller (backend success)
module.exports.tests.functional_success = function(test, common) { module.exports.tests.functional_success = function(test, common) {
// expected geojson features for 'client/doc/ok/1' fixture // expected geojson features for 'client/place/ok/1' fixture
var expected = [{ var expected = [{
type: 'Feature', type: 'Feature',
geometry: { geometry: {

4
test/unit/run.js

@ -4,14 +4,14 @@ var common = {};
var tests = [ var tests = [
require('./controller/index'), require('./controller/index'),
require('./controller/doc'), require('./controller/place'),
require('./controller/search'), require('./controller/search'),
require('./service/mget'), require('./service/mget'),
require('./service/search'), require('./service/search'),
require('./sanitiser/suggest'), require('./sanitiser/suggest'),
require('./sanitiser/search'), require('./sanitiser/search'),
require('./sanitiser/reverse'), require('./sanitiser/reverse'),
require('./sanitiser/doc'), require('./sanitiser/place'),
require('./sanitiser/coarse'), require('./sanitiser/coarse'),
require('./query/indeces'), require('./query/indeces'),
require('./query/sort'), require('./query/sort'),

8
test/unit/sanitiser/place.js

@ -1,7 +1,7 @@
var doc = require('../../../sanitiser/doc'), var place = require('../../../sanitiser/place'),
_sanitize = doc.sanitize, _sanitize = place.sanitize,
middleware = doc.middleware, middleware = place.middleware,
indeces = require('../../../query/indeces'), indeces = require('../../../query/indeces'),
delimiter = ':', delimiter = ':',
defaultLengthError = function(input) { return 'invalid param \''+ input + '\': text length, must be >0'; }, defaultLengthError = function(input) { return 'invalid param \''+ input + '\': text length, must be >0'; },
@ -190,7 +190,7 @@ module.exports.tests.middleware_success = function(test, common) {
module.exports.all = function (tape, common) { module.exports.all = function (tape, common) {
function test(name, testFunction) { function test(name, testFunction) {
return tape('SANTIZE /doc ' + name, testFunction); return tape('SANTIZE /place ' + name, testFunction);
} }
for( var testCase in module.exports.tests ){ for( var testCase in module.exports.tests ){

Loading…
Cancel
Save