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

add failing E2E test #531

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open

Conversation

mrjgreen
Copy link

@mrjgreen mrjgreen commented Oct 3, 2023

test with

cd test/e2e
npm test

@netlify
Copy link

netlify bot commented Oct 3, 2023

Deploy Preview for routify-v3-example canceled.

Name Link
🔨 Latest commit 49556ce
🔍 Latest deploy log https://app.netlify.com/sites/routify-v3-example/deploys/651bc4a8d12d6f00085d66b5

@jakobrosenberg
Copy link
Member

Thank you so much for this.

@mrjgreen
Copy link
Author

mrjgreen commented Oct 3, 2023

No problem - I've no idea if this will work in CI, but it's a starting point for me to try and figure out why the module replacement doesn't seem to be working for me.

I'd be keen to help get these tests into a useful shape though so if you think this could be something we eventually want to merge I'd be happy to make any required changes.

@jakobrosenberg
Copy link
Member

Thanks again for the PR. I'm thinking this should probably be an integration test rather than E2E. I don't know if this is something you want to try. If not, I'll be happy to do it.

Also, are you on Discord by any chance?

@mrjgreen
Copy link
Author

mrjgreen commented Oct 3, 2023

I'd be happy enough to try - would that belong in test/integration/routify-runtime/routify.test.js ?

I'm not on discord.

@jakobrosenberg
Copy link
Member

jakobrosenberg commented Oct 3, 2023

I think the best place would be test/integration/composition. Similar to test/integration/meta.

You would have to do something like

    const { default: routes } = await import('./temp/routes.default.js')
    const instance = new RoutifyRuntime({ routes })
    const router = instance.routers[0]
    await router.url.push('/some/route')
    const route = router.activeRoute.get()

    // run tests on route.fragments. Each fragment contains a node with a component to be rendered. Eg. a `reset` would have fewer fragments than a `prepend`
    assert.equal(route.fragments.map(fragment => fragment.node.name), [/*names of nodes to be rendered*/])

But really. You should only do this for your enjoyment since I expect you might hit some obstacles due to the lack of documentation for R3s internal code.

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.

2 participants