kabisa / kudos-frontend

The frontend for the Kudos-o-Matic! (Mobile / Desktop)
2 stars 0 forks source link

Try out test helper #193

Closed matthijsgroen closed 2 months ago

matthijsgroen commented 2 months ago

What

Experiment with the setComponent concept that is also used @ Payt.

☝️ @nickve28

Why

This will prove this model, and work as reference for other codebases. This can then also be referenced from the FE Golden Path documentation

Code Review

Please consider the following checklist when reviewing this Pull Request.
More background and details here.

nickve28 commented 2 months ago

Nice! Erg mooie uitvoer met TS typings ook. Wellicht zou wat JSdoc toevoegen ook helpen, dan heb je 2 vliegen in 1 klap (ook voor het golden path meteen)

nickve28 commented 2 months ago

Je zou er nog voor kunnen kiezen om een 'wait for element to be removed' / loading indicator afwachten stap toe te voegen, dat heeft payt ook, ipv de standaard

const view = renderComponent()
await waitForElementTobeRemoved(() => expect(screen.queryByText("loading...")).not.toBeIntheDocument()
  setComponent(MyComponent, { waitForElementToBeRemoved: () => screen.queryByTestId('loading-icon') })

zij doen het zo, met een 'await' op renderComponent bijv

codeclimate[bot] commented 2 months ago

Code Climate has analyzed commit f72e56aa and detected 7 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Style 6

The test coverage on the diff in this pull request is 96.7% (50% is the threshold).

This pull request will bring the total coverage in the repository to 71.5% (1.2% change).

View more on Code Climate.