Skip to content

Conversation

jeeyyy
Copy link
Collaborator

@jeeyyy jeeyyy commented Jun 12, 2019

Note: will merge this PR after one approval, given most of them are code changes.

This PR does the below:

  • Parses & generates metrics from all implementations submitted by various contributor.
  • Shows implementation metrics at various parts of the site.
  • Refactors meta data generation, outside of gatsby createNode hooks
    • generation of testcases specified in rules.
    • generation of glossary usages in rules.
    • generation of implementation metrics.

Because of the large nature of the PR. I have deployed this branch to netlify to see how implementations are depicted on the site.

Note: I will remove this netlify hook after this branch is merged.

@jeeyyy jeeyyy requested a review from WilcoFiers June 12, 2019 16:15
@jeeyyy jeeyyy changed the title [WIP] chore: Generate implementation metrics chore: Generate and display implementation metrics Jun 12, 2019
@jeeyyy jeeyyy added the Chore label Jun 12, 2019
@jeeyyy jeeyyy self-assigned this Jun 12, 2019
@jeeyyy jeeyyy marked this pull request as ready for review June 12, 2019 17:36
@CLAassistant
Copy link

CLAassistant commented Jun 13, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Can you please add unit tests for this code?

@jeeyyy jeeyyy requested a review from WilcoFiers June 17, 2019 14:36
@jeeyyy
Copy link
Collaborator Author

jeeyyy commented Jun 17, 2019

@WilcoFiers

I had to refactor quite a bit of pre-processing to be outside of gatsby lifecycle hooks. I moved these to be individual npm scripts. This gives us greater control to keep subsets of functionality and data generation.

Added tests & below is the coverage (have plans to improve this stat after this PR).

image

image

Copy link
Collaborator

@annethyme annethyme left a comment

Choose a reason for hiding this comment

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

Please correct company name for Siteimprove :)

@EmmaJP
Copy link
Collaborator

EmmaJP commented Jun 27, 2019

Links from rule pages to implementation reports appear to include an anchor reference in the link that isn't jumping to an anchor in the page. Seems to be a bug.

eg. https://eloquent-lumiere-13f4f9.netlify.com/rules/97a4e1#implementation-metrics lists 3 reports. The Axe link goes to https://eloquent-lumiere-13f4f9.netlify.com/implementation/axe#97a4e1 which doesn't jump to the relevant part of the report.

@jeeyyy jeeyyy requested a review from annethyme July 1, 2019 12:05
@jeeyyy jeeyyy removed the Agenda item label Jul 1, 2019
@jeeyyy
Copy link
Collaborator Author

jeeyyy commented Jul 1, 2019

@EmmaJP The scroll issue is now resolved.

Copy link
Member

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

Please merge the PR and fix the various comments in separate PRs. I don't want to have to review another 63 file change PR. :/

expect(() => getAssertions(null)).toThrow()
)

it('returns assertions from framed reports', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Your tests don't prove that these are assertions, that they are correct, and that you have the right number of them.

['@context', '@graph'].forEach((key) => {
expect(keys.includes(key)).toBe(true)
})
expect(report['@graph'].length).toBeGreaterThan(0)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't prove that you've framed the report correctly.

expect(result).toBeDefined()
expect(result.length).toBeGreaterThan(0)
result.forEach((data) => {
expect(Object.keys(data)).toEqual(['ruleId', 'ruleName', 'implementation'])
Copy link
Member

Choose a reason for hiding this comment

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

How does this tell you if any of these are correct?

* @param {Object} assertion assertion
* @param {Object} tc testcase
*/
const getTestcaseMapping = (assertion, { expected }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Tests needed.

* @param {Array<Object>} assertions assertions
* @param {String} relativeUrl relative url of testcase
*/
const getTestcaseAssertions = (assertions, relativeUrl) => {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of having this pass the relative URL, why don't you have the test case passed in, have this method figure out the relative URL and decide based on that. Seems like better encapsulation that way.


&.page-implementers {
h1, h2, h3, h4, h5, h6 {
display: inline-block;
Copy link
Member

Choose a reason for hiding this comment

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

Headings definitely shouldn't be inline things. Headings are to give a high level structure of the page, not for individual pieces of data.

</li>
)
})}
{inputRules.map(inputRuleId => {
Copy link
Member

Choose a reason for hiding this comment

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

Please try to keep your logic code a little separated from your UI code. It's hard to read.

const { context } = sitePage
const { title: pageTitle, data: contextData } = context

const updatedTitle = `${pageTitle} | ${site.siteMetadata.title}`
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't SEO do this automatically?

@jeeyyy jeeyyy merged commit a8065b3 into develop Jul 3, 2019
@jeeyyy jeeyyy deleted the add-implementations branch July 3, 2019 20:02
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

Successfully merging this pull request may close these issues.

5 participants