osmdata
                                
                                
                                
                                    osmdata copied to clipboard
                            
                            
                            
                        Update tests to use internal sample .osm file
Most of the tests could be run with no mocking at all, by just using an internal .osm file.
@jmaspons What are your thoughts on this issue? Mock tests are currently only in these four files:
- 
Single mock call only which could be replaced: https://github.com/ropensci/osmdata/blob/503674690ab3763cf5ea48e699c3466849c2e24f/tests/testthat/test-unname.R#L15-L17
 - 
In
test-features.R, which can't be replaced by an internal file. - 
Single mock call only which could be replaced: https://github.com/ropensci/osmdata/blob/503674690ab3763cf5ea48e699c3466849c2e24f/tests/testthat/test-elevation.R#L11-L13
 - 
In
test-getbb.R, with lots of mocked calls to nominatim which likely can't be replaced. - 
Lots of calls in
test-osmdata.Rwhich likely could be replaced by using a local file instead of mocking: https://github.com/ropensci/osmdata/blob/503674690ab3763cf5ea48e699c3466849c2e24f/tests/testthat/test-osmdata.R#L267-L269 
That suggests this, which would be good to do for current (v0.1.2) release:
TODO
- [ ] Replace single mock call in 
test-unname.Rthrough using local file. - [ ] Replace single mock call in 
test-elevation.Rthrough using local file. - [ ] Replace most (all?) mock calls in 
test-osmdata.Rthrough using local file instead. 
Mock calls are cool! I would keep them in the places where we actually want to check the functionality, ie. test-osmdata.R to check overpass_query function. In other places such as test-elevation.R or test-unname.R it's not necessary because there we are testing other functions, but it doesn't hurt.
All in all, if the test coverage doesn't degrade, both approaches are fine. What can be interesting to reduce the package size is to reuse the mock calls. I don't see why we need different queries for each osmdata_* function. Perhaps different mock calls for different query types (adiff, diff, tags...) is enough if needed at all (.osm files also works for checking all the code paths).