-
Notifications
You must be signed in to change notification settings - Fork 3
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
unit-tests to check ‘shortAddr’ function #48
base: main
Are you sure you want to change the base?
Conversation
@tectonick |
“@DS-jr, I think the root cause of this error is that the
|
@tectonick Unit-tests are working ok after that. If NO new bugs / mistakes in my code - please, confirm that #48 can be closed. |
@tectonick I’ve changed manually only several lines of code (Ex.: added "jsdom" dependency), but 200+ modifications happened in the repo according to git. This is how JS dependencies are updated automatically without my involvement, correct? |
tests/unit/index.test.js
Outdated
it("must return 'false' for an empty wallet", () => { | ||
vi.mocked(get).mockReturnValueOnce({}); // TypeError: vi.mocked(...).mockReturnValueOnce is not a function | ||
expect(isAuthenticated()).toBe(false); | ||
// vi.mock(get, {}).mock(); // Error: Expression expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest removing commented out code, it's not needed under source control.
tests/unit/index.test.js
Outdated
// } | ||
describe("isAuthenticated", () => { | ||
it("must return 'false' for an empty wallet", () => { | ||
vi.mocked(get).mockReturnValueOnce({}); // TypeError: vi.mocked(...).mockReturnValueOnce is not a function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not expected during correct mocking to have such error TypeError: vi.mocked(...).mockReturnValueOnce is not a function.
The vi.mocked
function allows TypeScript users to cast an object to a mocked type, although it does not offer any mocking functionality on its own.
Check this doc https://vitest.dev/guide/mocking.html, it shows good examples of correct mocking in vitest.
@DS-jr it's ok. A package lock file is generated by package managers like npm, pnpm or yarn. It serves as a snapshot of the exact versions of all dependencies and their transitive dependencies installed in a project at a given time. Its changes should be committed to the git repository. |
No description provided.