From 7abf2870fe677819d6fba8b930d2d5ccf8567140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sun, 31 Jul 2016 20:23:12 -0700 Subject: [PATCH] Test uppercase network suggestions (#3296) --- test/spec/services/taginfo.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/spec/services/taginfo.js b/test/spec/services/taginfo.js index 194e7df61..4ae34f76c 100644 --- a/test/spec/services/taginfo.js +++ b/test/spec/services/taginfo.js @@ -173,6 +173,28 @@ describe('iD.services.taginfo', function() { expect(callback).to.have.been.calledWith(null, [{'value':'parking','title':'A place for parking cars'}]); }); + + it('includes network values with capital letters and some punctuation', function() { + var callback = sinon.spy(); + taginfo.values({key: 'network', query: 'us'}, callback); + + server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/key/values'), + [200, { 'Content-Type': 'application/json' }, + '{"data":[{"value":"US:TX:FM","description":"Farm to Market Roads in the U.S. state of Texas.", "fraction":0.34},' + + '{"value":"US:KY","description":"Primary and secondary state highways in the U.S. state of Kentucky.", "fraction":0.31},' + + '{"value":"US:US","description":"U.S. routes in the United States.", "fraction":0.19},' + + '{"value":"US:I","description":"Interstate highways in the United States.", "fraction":0.11},' + + '{"value":"US:MD","description":"State highways in the U.S. state of Maryland.", "fraction":0.06}]}']); + server.respond(); + + expect(callback).to.have.been.calledWith(null, [ + {'value':'US:TX:FM','title':'Farm to Market Roads in the U.S. state of Texas.'}, + {'value':'US:KY','title':'Primary and secondary state highways in the U.S. state of Kentucky.'}, + {'value':'US:US','title':'U.S. routes in the United States.'}, + {'value':'US:I','title':'Interstate highways in the United States.'}, + {'value':'US:MD','title':'State highways in the U.S. state of Maryland.'} + ]); + }); }); describe('#docs', function() {