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

Set up testing for token bridge tutorial typescript setup code #295

Open
Tracked by #220
critesjosh opened this issue Jun 4, 2024 · 1 comment
Open
Tracked by #220

Comments

@critesjosh
Copy link
Collaborator

There is setup code that is hardcoded for the cross_chain_messaging.test.ts in this page of the docs.

This section is hard coded because the original e2e test uses a util.js file that uses a bunch of packages that are not published to npm. We use the hard coded section to only use the publicly published packages, but this code can get out of date and will not trigger any failing tests.

Update the e2e tests to include this section of code, and then import it into the docs so it is ensured to always be up to date.

@critesjosh
Copy link
Collaborator Author

I looked into this a little bit and it is going to be non-trivial to do well. The glue code snippet in the docs pulls tests from 2 different test files and has its own setup code.

The most straightforward way to get this to work is to create a new e2e test file, add the specific setup code that is required (and import this directly into the docs using the #include_code macro) and then copy the the test functions from the other two files into this test file. The problem with this approach is that it copy+pastes test code across multiple files, so there is redundancy. If the test needs to change, it needs to updated in two places. I couldn't figure out a good way to be able to write the test function in one place while keeping it nice for the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant