mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
65 lines
2.4 KiB
var sanitize = require('../../../sanitizer/_deprecate_quattroshapes'); |
|
|
|
module.exports.tests = {}; |
|
|
|
module.exports.tests.warning_message_1 = function(test, common) { |
|
test('[qs] should emit a deprecation warning', function(t) { |
|
var raw = { sources: 'qs' }; |
|
var clean = {}; |
|
|
|
var messages = sanitize(raw, clean); |
|
t.deepEquals(messages, { |
|
errors: [], |
|
warnings: ['You are using Quattroshapes as a data source in this query. ' + |
|
'Quattroshapes has been disabled as a data source for Mapzen Search, and has been' + |
|
'replaced by Who\'s on First, an actively maintained data project based on Quattroshapes' + |
|
'Your existing queries WILL CONTINUE TO WORK for the foreseeable future, but results will ' + |
|
'be coming from Who\'s on First and `sources=quattroshapes` will be interpreted as ' + |
|
'`sources=whosonfirst`. If you have any questions, please email search@mapzen.com.'] |
|
}, 'warning emitted'); |
|
|
|
t.end(); |
|
}); |
|
}; |
|
|
|
module.exports.tests.warning_message_2 = function(test, common) { |
|
test('[quattroshapes] should emit a deprecation warning', function(t) { |
|
var raw = { sources: 'quattroshapes' }; |
|
var clean = {}; |
|
|
|
var messages = sanitize(raw, clean); |
|
t.deepEquals(messages, { |
|
errors: [], |
|
warnings: ['You are using Quattroshapes as a data source in this query. ' + |
|
'Quattroshapes has been disabled as a data source for Mapzen Search, and has been' + |
|
'replaced by Who\'s on First, an actively maintained data project based on Quattroshapes' + |
|
'Your existing queries WILL CONTINUE TO WORK for the foreseeable future, but results will ' + |
|
'be coming from Who\'s on First and `sources=quattroshapes` will be interpreted as ' + |
|
'`sources=whosonfirst`. If you have any questions, please email search@mapzen.com.'] |
|
}, 'warning emitted'); |
|
|
|
t.end(); |
|
}); |
|
}; |
|
|
|
module.exports.tests.rewrite = function(test, common) { |
|
test('should rewrite qs and quattroshapes to whosonfirst', function(t) { |
|
var raw = { sources: 'qs,quattroshapes,qs,quattroshapes,osm' }; |
|
var clean = {}; |
|
|
|
sanitize(raw, clean); |
|
t.equals(raw.sources,'osm,whosonfirst','use wof instead of qs'); |
|
|
|
t.end(); |
|
}); |
|
}; |
|
|
|
module.exports.all = function (tape, common) { |
|
function test(name, testFunction) { |
|
return tape('SANTIZE _deprecate_quattroshapes ' + name, testFunction); |
|
} |
|
|
|
for( var testCase in module.exports.tests ){ |
|
module.exports.tests[testCase](test, common); |
|
} |
|
};
|
|
|