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

MWPW-144683 Article Header Unit Test #44

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

meganthecoder
Copy link
Contributor

Related to: MWPW-144683

Test URLs:
N/A

@meganthecoder meganthecoder added the trivial It doesn't affect the FE and doesn't need to be tested label Apr 10, 2024
Copy link

aem-code-sync bot commented Apr 10, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Comment on lines +1 to +11
export function loadTaxonomy() {

}

export function getLinkForTopic() {
return '#';
}

export function getTaxonomyModule() {
return true;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To explain:

These are here as mocks for the external milo scripts, as called out as best practice by the community. Before, I've tried to use import maps like we do in milo tests, but they don't work with template strings in dynamic imports. Here, I'm mocking the external scripts by setting milo libs to pull from the localhost mocks folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Brandon32 Let me know if you have further questions

@JasonHowellSlavin
Copy link
Contributor

Not blocking, but I do wonder if this unit test doesn't belong in Milo itself? I understand we are testing the implementation that occurs in our utils.js, but wondering if we could skip some of the mocks by adding the test in milo? Or even what about the test in Milo was inadequate to catch our use case?

@meganthecoder
Copy link
Contributor Author

meganthecoder commented Apr 11, 2024

Not blocking, but I do wonder if this unit test doesn't belong in Milo itself? I understand we are testing the implementation that occurs in our utils.js, but wondering if we could skip some of the mocks by adding the test in milo? Or even what about the test in Milo was inadequate to catch our use case?

I don't think that tests in milo would adequately cover our use case. The article header block in milo requires a very specific input or else it errors out and the block doesn't build correctly. That's essentially what we're testing here: Does the code in bacom blog utils provide correctly formatted data for the article header block to use?

Edit: It's possible that we could avoid mocking milo libs by rewriting buildArticleHeader but I don't see why we should. What's the objection to the way I'm mocking? It came from a suggestion by Okan.

@JasonHowellSlavin
Copy link
Contributor

Not blocking, but I do wonder if this unit test doesn't belong in Milo itself? I understand we are testing the implementation that occurs in our utils.js, but wondering if we could skip some of the mocks by adding the test in milo? Or even what about the test in Milo was inadequate to catch our use case?

I don't think that tests in milo would adequately cover our use case. The article header block in milo requires a very specific input or else it errors out and the block doesn't build correctly. That's essentially what we're testing here: Does the code in bacom blog utils provide correctly formatted data for the article header block to use?

Edit: It's possible that we could avoid mocking milo libs by rewriting buildArticleHeader but I don't see why we should. What's the objection to the way I'm mocking? It came from a suggestion by Okan.

No objection to the way it's done. Just finding the test interesting, and what it necessitates interesting. "Does the code in bacom blog utils provide correctly formatted data for the article header block to use" is not something I think we've tested for in other consumer repos, and it exposes that the article-header may have been built incorrectly from the start according to current Milo practices. Nothing to be done in this PR, but food for thought nonetheless.

@meganthecoder meganthecoder merged commit 07686da into stage Apr 11, 2024
4 of 5 checks passed
@meganthecoder meganthecoder deleted the methomas/article-header-tests branch April 11, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trivial It doesn't affect the FE and doesn't need to be tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants