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

Figure out how to test UserCardComponent #522

Open
NicMcPhee opened this issue Feb 16, 2021 · 2 comments
Open

Figure out how to test UserCardComponent #522

NicMcPhee opened this issue Feb 16, 2021 · 2 comments

Comments

@NicMcPhee
Copy link
Member

There essentially no logic in UserCardComponent, so it's not obvious what or how to test it.

We used to have a test that mocked a whole bunch of stuff and then confirmed that it "built" OK, but nothing else.

I removed that because I thought it was a lot of complicated code with little to no payoff. It turns out that because it's used in other, tested components, the test coverage is still fine with these tests removed, but that testing is obviously "indirect" in nature.

@floogulinc has made a reasonable argument that we should at least test that the component builds and initializes properly, but I didn't really have time to figure out what that would look like in this lab, so I left it so that it's only tested indirectly.

Maybe the "real" solution is to give UserCardComponent some work to do? We don't want to add "fluff" functionality just to make testing make sense, but there might be reasonable functionality that we could add?

@kklamberty
Copy link
Member

An e2e test that checks basically anything would test that it's there. Note (partially to myself): We won't ever have to write .should('exist') https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Default-Assertions in our Cypress tests. There are several commits on the user-card.component.spec.ts that add, adjust, or remove the testing. I am fairly satisfied with the single test that is here and shows it was created.

@NicMcPhee
Copy link
Member Author

It looks like the way to do this is to have a test container component, and then you can at least test that the @Inputs are working. I included links to various things that would be helpful in a companion issue on the iteration template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants