Skip to content

Commit

Permalink
some consistency checks for README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rlindner81 committed Mar 15, 2024
1 parent 980263c commit ae83a90
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can also not install the tool and use it ad-hoc.
# ad-hoc
npx @cap-js-community/mtx-tool
# ad-hoc with fixed version, e.g. for stable pipelines
npx @cap-js-community/[email protected].1
npx @cap-js-community/[email protected].2
```

## Support, Feedback, Contributing
Expand Down
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ npm install --global @cap-js-community/mtx-tool
npm install --save-dev @cap-js-community/mtx-tool
```

You can also not install the tool and use it ad-hoc.

```bash
# ad-hoc
npx @cap-js-community/mtx-tool
# ad-hoc with fixed version, e.g. for stable pipelines
npx @cap-js-community/[email protected]
```

## Content

| Area | Purpose | Related |
Expand Down
16 changes: 16 additions & 0 deletions test/cli.test.js → test/consistency.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ const appCliOptions = Object.values(require("../src/cliOptions")).filter((option
*/

describe("cli tests", () => {
test("readme version is up-to-date", async () => {
const readme = readFileSync(join(__dirname, "..", "README.md")).toString();
const readmeInstall = /(## Install or Upgrade\n\n[\s\S]*?)\n##/g.exec(readme)[1];
const readmeVersion = /@cap-js-community\/mtx-tool@v(\d+\.\d+\.\d+)/g.exec(readmeInstall)[1];
const packageInfo = JSON.parse(readFileSync(join(__dirname, "..", "package.json")).toString());
expect(readmeVersion).toEqual(packageInfo.version);
});

test("readme install matches docs", async () => {
const readme = readFileSync(join(__dirname, "..", "README.md")).toString();
const readmeInstall = /(## Install or Upgrade\n\n[\s\S]*?)\n##/g.exec(readme)[1];
const docs = readFileSync(join(__dirname, "..", "docs", "index.md")).toString();
const docsInstall = /(## Install or Upgrade\n\n[\s\S]*?)\n##/g.exec(docs)[1];
expect(readmeInstall).toEqual(docsInstall);
});

test("documentation quickstart usage / cli usage consistency check", async () => {
const readme = readFileSync(join(__dirname, "..", "docs", "index.md")).toString();
const readmeUsage = /## Quickstart\n\n```\n([\s\S]*?)```/g.exec(readme)[1];
Expand Down

0 comments on commit ae83a90

Please sign in to comment.