Skip to content

tests: store SVG and URI values to files #1272

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

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

Conversation

Hayk-1315
Copy link

Hi,

This PR addresses issue #1264.

Moved hardcoded expectedSVG and expectedTokenURI strings from test files to separate files under tests/data/

Used vm.readFile to load the content in both generateSVG.t.sol and tokenURI.t.sol

Ensured test logic remains intact and structure unchanged

No other modifications to business logic

Let me know if you'd like the file locations to be changed or prefer another folder structure for test fixtures.

Thanks in advance!

@smol-ninja
Copy link
Member

Thank you for the PR @Hayk-1315. The lint checks are failing. Would you like to fix them?

You can use just full-check to run lint checks locally and just full-write to format the code. Recently, we migrated to Just as our preferred runner command. You can find the details in the contribution guide on how to install and use it.

Let me know if you have any question about it.

@Hayk-1315
Copy link
Author

Hi ;)
Lint errors fixed using just full-write.
Let me know if anything else needs adjustment.

Thanks in advance!

@smol-ninja smol-ninja changed the title refactor(tests): load SVG and tokenURI strings from files using vm.readFile tests: load SVG and tokenURI strings from files using vm.readFile Jul 16, 2025
@smol-ninja smol-ninja changed the title tests: load SVG and tokenURI strings from files using vm.readFile tests: store SVG and URI values to files Jul 16, 2025
@Hayk-1315
Copy link
Author

Hello!

I wanted to provide an update regarding the failing test in "generateSVG.t.sol".

All three SVG files were moved to "tests/data/", and are being read using "vm.readFile(...)". I’ve confirmed:

  • The files are properly encoded as UTF-8 without BOM
  • Line endings are set to LF
  • Paths are correct and relative to the project root
  • The "--ffi" flag is enabled in local tests
  • The other test using "vm.readFile("tests/data/token_uri.json")" passes successfully

Despite this, I'm still getting the following error locally, even with "--ffi":

vm.readFile: the path tests/data/expected_svg_1.svg is not allowed to be accessed for read operations

This leads me to believe it might be related to a sandbox or security policy in the local environment, or potentially a project-level restriction on certain file types or paths.

Let me know if there's anything specific in the CI configuration that I should adapt to or to adjust the structure or move the test if needed!

Thanks again for the review and guidance.

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