node-scripts-docs
Version:
Generate documentation for your `package.json` scripts.
31 lines • 1.29 kB
JavaScript
import { isDefaultDescription, makeDocumentation } from "./FragmentRenderer.js";
it("identifies pending description", () => {
expect(isDefaultDescription("_documentation pending_")).toBe(true);
expect(isDefaultDescription("Some description")).toBe(false);
});
it("renders fragment with existing description", () => {
const meta = {
description: "Build the latest sources and then use the build output to execute your command. Parameters are passed through by `yarn`.",
manifestPath: "package.json",
projectName: "node-scripts-docs",
scriptName: "docs:scripts",
scriptCode: "yarn nsd-debug --include-locals",
isGlobal: true,
isRootManifest: true,
};
const fragment = makeDocumentation(meta, meta.description);
expect(fragment).toMatchSnapshot();
});
it("renders fragment without description", () => {
const meta = {
manifestPath: "package.json",
projectName: "node-scripts-docs",
scriptName: "docs:scripts",
scriptCode: "yarn nsd-debug --include-locals",
isGlobal: true,
isRootManifest: true,
};
const fragment = makeDocumentation(meta, meta.description);
expect(fragment).toMatchSnapshot();
});
//# sourceMappingURL=FragmentRenderer.test.js.map