telosnetwork/telos-wallet

Investigate failing unit tests

Closed this issue · 0 comments

Overview

Some unit tests are failing on github CI. It seems that the paradigm we use for mocking our antelope dependencies in unit tests is faulty. It is unclear why the tests were not failing before (or perhaps they were, and we missed it...?). The issue seems to stem from the fact that jest.mock statements are hoisted to the top of the file they are declared in, but in our code, those statements rely on consts declared in the same file above the jest.mock statements. The issue may also stem from our usage of barrel files, possibly leading to unnecessary, unmocked deps being pulled in. We likely need to figure out a different way to mock antelope deps. One possible avenue to explore is declaring and exporting all mock data structures and stores in one file, then in another, actually doing the call to jest.mock. Another possible solution is switching to use jest.doMock which is not hoisted, but this comes with its own set of problems (i.e. it is not as easy as just replacing jest.mock with jest.doMock everywhere).

Acceptance Criteria

Uncomment tests in balances.spec.ts, EVMLoginButtons.spec.ts, and WalletBalanceRow.spec.ts and fix them so they pass

Image

Image