Validating Documentation Generation Workflow in GatsbyJS
This test suite validates the documentation generation functionality for WordPress plugin options in Gatsby. It ensures that plugin options documentation is properly generated and matches expected output through automated verification.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gatsbyjs/gatsby
packages/gatsby-source-wordpress/__tests__/docs-generation.test.js
import { getPluginOptionsMdString } from "../generate-plugin-options-docs"
import fs from "fs-extra"
import path from "path"
describe(`Plugin options docs`, () => {
test(`Docs have been generated by running "yarn build" or "yarn generate-plugin-options-docs"`, async () => {
const generatedDocsFileContents = await fs.readFile(
path.join(__dirname, `../docs/plugin-options.md`),
`utf-8`
)
const mdString = await getPluginOptionsMdString()
expect(generatedDocsFileContents).toBeTruthy()
expect(mdString).toBeTruthy()
expect(generatedDocsFileContents).toEqual(mdString)
})
})