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

4
test/ciao/place/msuccess.coffee

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

4
test/ciao/place/success.coffee

@ -1,6 +1,6 @@
#> valid doc query
path: '/doc?id=geoname:4221195'
#> valid place query
path: '/place?id=geoname:4221195'
#? 200 ok
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');
module.exports.tests = {};
@ -14,7 +14,7 @@ module.exports.tests.interface = function(test, common) {
// functionally test controller (backend success)
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 = [{
type: 'Feature',
geometry: {

4
test/unit/run.js

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

8
test/unit/sanitiser/place.js

@ -1,7 +1,7 @@
var doc = require('../../../sanitiser/doc'),
_sanitize = doc.sanitize,
middleware = doc.middleware,
var place = require('../../../sanitiser/place'),
_sanitize = place.sanitize,
middleware = place.middleware,
indeces = require('../../../query/indeces'),
delimiter = ':',
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) {
function test(name, testFunction) {
return tape('SANTIZE /doc ' + name, testFunction);
return tape('SANTIZE /place ' + name, testFunction);
}
for( var testCase in module.exports.tests ){

Loading…
Cancel
Save