@jamesshore Do you have an example how to test a router using testing without mocks?
By router I mean an entry level function that looks at a url or command line arguments or whatever and dispatches to the relevant "controller".
Example:
class MyWebApp:
def main(self, url):
if url.startswith("/home"):
self.home_controller.run(...)
elif url.startswith("/about"):
self.about_controller.run(...)
@rickardlindberg I sure do. Check out these files in my 'complex' testing without mocks example:
GenericRouter: https://github.com/jamesshore/testing-without-mocks-complex/blob/javascript/src/node_modules/http/generic_router.js
WwwRouter (uses GenericRouter): https://github.com/jamesshore/testing-without-mocks-complex/blob/javascript/src/www/www_router.js
They're both fairly straightforward pieces of code. The secret sauce is the nullable HttpServerRequest, which has the HTTP method, url, etc. https://github.com/jamesshore/testing-without-mocks-complex/blob/javascript/src/node_modules/http/http_server_request.js