#79 Notify user if selected object is not a building#87
#79 Notify user if selected object is not a building#87deevroman wants to merge 1 commit intoBeakerboy:mainfrom
Conversation
…ther errors occur
|
@Beakerboy it seems there are no tests that mock the API yet, so I would say a slight decrease in coverage is expected due to the addition of exception catching. |
|
What API tests do you recommend? I have a mocking system set up to mock calls to the API and I do have tests against the building object. Could you add a test to test/building.test.js for this? |
|
I don't quite understand how you want to organize API tests. On one hand, I see that you redefined the API URL in On the other hand I see |
|
What I’m trying to get at is, the changes here are all within the Building class, not the API. There’s plenty of ways to get data into the Building class to make sure that an error is printed or thrown when non-building data is provided. maybe this gets to the heart of the problem, should the Building class be making network calls at all? Should it be agnostic and just use the data that is given to it from whatever source? Maybe we need better dependency separation to do dependency injection. |
|
yeah, it would be nice to split |
|
The constructor can be tested without having to call Also…in case it was not obvious, I barely know how to program JavaScript, and I only dabble in programming in general. I’m more than happy to change the way any of this is done to make it more in line with JavaScript norms, or to make it easier to test and extend. I had an idea of a program that I wanted and that did not exist, so I took it as an opportunity to learn JavaScript. Smaller, more focused pull requests are better so I can see what’s going on and ask questions. |
|
No problem, let's do it in small commits. I converted complex PRs into drafts p.s. writing a 3D render is quite a non-trivial task :) |
I changed the isValidData method to validateDate so that it throws an exception in case of invalid data. The error is intercepted and displayed as an alert.
I also added checking HTTP codes for requests that receive information about objects. In practice, I very often forget to specify
&type=relation, so it should be useful. Especially after adding osmApiUrl