Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh authored Sep 1, 2021
1 parent 751f71f commit 78e095e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions packages/eslint-plugin-next/lib/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ function getUrlFromPagesDirectories(urlPrefix, directories) {
(url) => `^${normalizeURL(url)}$`
)
)
).map((urlReg) => {
// /foo/[bar] filees fails without this.
urlReg = urlReg.replace(/\[/g, "\\[");
new RegExp(urlReg)
})
).map((urlReg) => new RegExp(urlReg))
}

// Cache for fs.readdirSync lookup.
Expand Down Expand Up @@ -77,6 +73,9 @@ function parseUrlForPages(urlprefix, directory) {
}
})
return res
// return res.map((expression) =>
// expression.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&')
// )
}

/**
Expand Down
3 changes: 2 additions & 1 deletion test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class Blah extends Head {
render() {
return (
<div>
<a href='/list/foo/bar'>Homepage</a>
<a href='/list/foo'>Homepage</a>
<h1>Hello title</h1>
</div>
);
Expand Down Expand Up @@ -160,6 +160,7 @@ describe('no-html-link-for-pages', function () {
const [report] = linter.verify(invalidDynamicCode, linterConfig, {
filename: 'foo.js',
})
console.log({ report })
assert.notEqual(report, undefined, 'No lint errors found.')
assert.equal(
report.message,
Expand Down

0 comments on commit 78e095e

Please sign in to comment.