I'd like to be able to stub server routes in Sapper so that I can test how the application behaves when it receives various responses and errors. However, the problem I'm running into is that Cypress's (which is part of the sapper template) routing stubs only work on XHR requests made from the browser which means that on the initial request for the page when sapper resolves preloaded server routes, the stubs have no effect. (In fact I suspect that even subsequent loads wouldn't be detected because they use fetch and not XMLHttpRequest objects, but I haven't tested this.)
Is there another way to mock Sapper's server routes for testing, or do I need to plan on using fixtures to seed a test database to create different test scenarios?
Aucun commentaire:
Enregistrer un commentaire