Skip to content

Commit

Permalink
Allow HTML validation to use cached HTML
Browse files Browse the repository at this point in the history
We can use the pre-built YAML-to-JSON fixture HTML to speed things up
  • Loading branch information
colinrotherham committed Nov 2, 2023
1 parent 1d53df3 commit c8a10cd
Showing 1 changed file with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,23 @@ describe('Components', () => {

// Validate component examples
for (const { component: componentName, fixtures } of componentsFixtures) {
const fixtureTasks = fixtures.map(
async ({ name: exampleName, options }) => {
const html = render(componentName, { context: options })
const fixtureTasks = fixtures.map(async (fixture) => {
const html = render(componentName, {
context: fixture.options,
fixture
})

// Validate HTML
return expect({
componentName,
exampleName,
report: await validator.validateString(html)
}).toEqual({
componentName,
exampleName,
report: expect.objectContaining({ valid: true })
})
}
)
// Validate HTML
return expect({
componentName,
exampleName: fixture.name,
report: await validator.validateString(html)
}).toEqual({
componentName,
exampleName: fixture.name,
report: expect.objectContaining({ valid: true })
})
})

// Validate all component examples in parallel
await Promise.all(fixtureTasks)
Expand Down

0 comments on commit c8a10cd

Please sign in to comment.