Skip to content

Commit

Permalink
Update tldr-lint.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaanspeck authored Sep 29, 2024
1 parent 1e082e0 commit 7ecbb9c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion specs/tldr-lint.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const mock = require('mock-fs');
const linter = require('../lib/tldr-lint.js');
const { lintFile, containsErrors, containsOnlyErrors } = require('./tldr-lint-helper');

Expand Down Expand Up @@ -185,9 +186,24 @@ describe('Common TLDR formatting errors', function() {
});

it('TLDR111\t' + linter.ERRORS.TLDR111, function () {
let errors = lintFile('pages/failing/111<.md').errors;
// Mocking the filesystem for just this test
mock({
'pages/failing/111<.md': `# jar
> JAR (Java Archive) is a package file format.
- Unzip file to the current directory:
\`jar -xvf *.jar\``
});

const errors = linter.processFile('pages/failing/111<.md', false, false).errors;

expect(containsOnlyErrors(errors, 'TLDR111')).toBeTruthy();
expect(errors.length).toBe(1);

// Restore filesystem after the test
mock.restore();
});
});

Expand Down

0 comments on commit 7ecbb9c

Please sign in to comment.