-
Notifications
You must be signed in to change notification settings - Fork 0
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
Try out test helper #193
Try out test helper #193
Conversation
Release 1.0.0
Release version 1.0.1
Release 1.1.0
Release 1.2.0 -- New design
Release 1.2.1
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) |
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()
zij doen het zo, met een 'await' op renderComponent bijv |
decorator: (Component: React.FC, settings: TSettings) => JSX.Element; | ||
}; | ||
|
||
export const setComponent = < |
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.
Function setComponent
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
), | ||
}; | ||
|
||
export const dataDecorator = <TSerialized extends object>( |
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.
Don't use object
as a type. The object
type is currently hard to use (see this issue).
Consider using Record<string, unknown>
instead, as it allows you to more easily inspect and use the keys.
}; | ||
|
||
export const dataDecorator = <TSerialized extends object>( | ||
mocks?: any, |
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.
Argument 'mocks' should be typed with a non-any type.
* @param settings | ||
* @returns | ||
*/ | ||
export const setComponent = < |
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.
Function setComponent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
export const tableDecorator: Decorator<"table", Record<string, unknown>> = { | ||
name: "table", | ||
settings: {}, | ||
decorator: (Component) => ( |
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.
Component definition is missing display name
*/ | ||
settings: TSettings; | ||
/** | ||
* Function do decorate incoming `Component`. This can be part of a larger chain. |
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.
'to decorate' denk ik
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.
lijkt mij prima zo
* @param settings | ||
* @returns | ||
*/ | ||
export const setTestSubject = < |
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.
Function setTestSubject
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit f72e56a and detected 7 issues on this pull request. Here's the issue category breakdown:
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. |
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.