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 98719ac commit 09810a8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions specs/tldr-lint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,19 @@ describe('Common TLDR formatting errors', function() {
expect(errors.length).toBe(1);
});

it('TLDR111\t' + linter.ERRORS.TLDR111, function() {
const basenameSpy = jest.spyOn(path, 'basename').mockImplementation((filePath) => {
return '111<';
});
const illegalCharacters = linter.ILLEGAL_WINDOWS_CHARACTERS.source.match(/\\u[0-9a-fA-F]{4}|[^\\]/g);
illegalCharacters.forEach((char) => {
it('TLDR111\t' + linter.ERRORS.TLDR111 + '\t - ${char}', function() {
const basenameSpy = jest.spyOn(path, 'basename').mockImplementation((filePath) => {
return `111${char}`;
});

const errors = lintFile('pages/failing/111.md').errors;
expect(containsOnlyErrors(errors, 'TLDR111')).toBeTruthy();
expect(errors.length).toBe(1);
const errors = lintFile(`pages/failing/111${char}.md`).errors;

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

basenameSpy.mockRestore();
});

describe('TLDR pages that are simply correct', function() {
Expand Down

0 comments on commit 09810a8

Please sign in to comment.