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

πŸ› [BUG] - jsdom testing environment is not supported by the sdk #1424

Open
davidecarpini opened this issue Oct 22, 2024 · 2 comments
Open

Comments

@davidecarpini
Copy link
Member

Description

the sdk should support also jsdom as a testing environment

frontend:test: TypeError: text.normalize is not a function
frontend:test:  ❯ Object.encode ../../../vechain-dapp-kit/node_modules/@vechain/sdk-core/dist/index.js:3452:12
frontend:test:     3450|   encode: function(text) {
frontend:test:     3451|     return TEXT_ENCODER.encode(
frontend:test:     3452|       text.normalize(NORMALIZATION_FORM_CANONICAL_COMPOSITION)
frontend:test:        |            ^
frontend:test:     3453|     );
frontend:test:     3454|   }

it works correctly with happy-dom instead

Reproduction URL

No response

Reproduction steps

1. Create a vitest frontend test that renders something, using SDK and jsdom
2.  you will get this error when you try to run it:

frontend:test: TypeError: text.normalize is not a function
frontend:test:  ❯ Object.encode ../../../vechain-dapp-kit/node_modules/@vechain/sdk-core/dist/index.js:3452:12
frontend:test:     3450|   encode: function(text) {
frontend:test:     3451|     return TEXT_ENCODER.encode(
frontend:test:     3452|       text.normalize(NORMALIZATION_FORM_CANONICAL_COMPOSITION)
frontend:test:        |            ^
frontend:test:     3453|     );
frontend:test:     3454|   }


### Screenshots

```bash
![DESCRIPTION](LINK.png)

Logs

No response

OS

No response

@freemanzMrojo
Copy link
Member

hi @davidecarpini I can see in the paths that you were working on the dapp-kit project. since it is open source, would you mind sharing a branch with this testing code so we reproduce the error from there (if it is not too inconvenient ofc)? thanks in advance!

@davidecarpini
Copy link
Member Author

yarn install:all && yarn test
on 'test-branch-for-sdk-jsdom-error' branch of the dapp-kit and you will get the error

Screenshot 2024-10-22 at 16 21 53

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

3 participants