Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag values with wiki page may be documented as bad #5461

Merged
merged 2 commits into from
Nov 7, 2018
Merged

tag values with wiki page may be documented as bad #5461

merged 2 commits into from
Nov 7, 2018

Conversation

matkoniecz
Copy link
Contributor

fixes #5460

warning: this proposed code change is not tested

@matkoniecz
Copy link
Contributor Author

matkoniecz commented Nov 3, 2018

Failed test is

includes unpopular values with a wiki page:

So test failure is a real problem.

Good news is that it will be easy to write a test for what I want to achieve here.

iD.serviceTaginfo
       #values
         includes unpopular values with a wiki page:

test is at

it('includes unpopular values with a wiki page', function() {

@matkoniecz
Copy link
Contributor Author

I attempted to invert tests covering inverted behaviour.

@matkoniecz
Copy link
Contributor Author

It is still failing with

  1) iD.serviceTaginfo
       #keys
         does not include unpopular keys with a wiki page:
     expected spy to have been called with arguments null, [{ title: "amenity", value: "amenity" }]
null
[{ title: "amenity", value: "amenity" }, { title: "amenityother", value: "amenityother" }] [{ title: "amenity", value: "amenity" }] 
  AssertionError@file:///home/mateusz/Desktop/tmp/iD/node_modules/chai/chai.js:9449:24
  assert@file:///home/mateusz/Desktop/tmp/iD/node_modules/chai/chai.js:239:31
  file:///home/mateusz/Desktop/tmp/iD/node_modules/sinon-chai/lib/sinon-chai.js:105:24
  methodWrapper@file:///home/mateusz/Desktop/tmp/iD/node_modules/chai/chai.js:7824:30
  file:///home/mateusz/Desktop/tmp/iD/test/spec/services/taginfo.js:99:53

I admit that I am not sure what this test is really reporting.

@matkoniecz
Copy link
Contributor Author

Maybe tests fails because instead of [{ title: "amenity", value: "amenity" }] it got [{ title: "amenity", value: "amenity" }, { title: "amenityother", value: "amenityother" }] [{ title: "amenity", value: "amenity" }]?

@bhousel
Copy link
Member

bhousel commented Nov 3, 2018

Maybe tests fails because instead of [{ title: "amenity", value: "amenity" }] it got [{ title: "amenity", value: "amenity" }, { title: "amenityother", value: "amenityother" }] [{ title: "amenity", value: "amenity" }]?

Yes probably this..

What I usually do is run iD locally, and then visit the test runner page http://localhost:8080/test in Chrome. It will run the tests in the browser and you can use the debugger to set breakpoints and figure out what's really going on 👍

@matkoniecz
Copy link
Contributor Author

matkoniecz commented Nov 3, 2018

Note to self: it is described in https://github.com/openstreetmap/iD#building-id

Note to self: Open http://localhost:8080/ in a web browser is missing in https://github.com/openstreetmap/iD/blob/master/CONTRIBUTING.md#building--installing (EDIT: nope, it is two sections later )(and test runner page http://localhost:8080/test seems to be missing in both) - fixing that may be a good PR.

@bhousel bhousel merged commit e285066 into openstreetmap:master Nov 7, 2018
@bhousel
Copy link
Member

bhousel commented Nov 7, 2018

I cleaned up the tests in a29af10

What I did was:

  • remove the test for unpopular values with a wiki page
  • restore the original test for unpopular keys with a wiki page

This matches what the code does now, and I think the intent of #5460

The code doesn't care about wiki pages for values anymore, so there is no need to test that behavior.
The code continues to give a boost to keys with wiki pages, so we do test that.

@matkoniecz
Copy link
Contributor Author

Thanks for merging and fixing tests! Hopefully my next PR will go even better :)

@matkoniecz matkoniecz deleted the matkoniecz-bad-tags branch November 7, 2018 16:55
@bhousel
Copy link
Member

bhousel commented Nov 7, 2018

Thanks for merging and fixing tests! Hopefully my next PR will go even better :)

Thanks! This PR was great, no worries! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop treating all tag values with OSM Wiki page as recommended
2 participants