aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-docs/src/__tests__
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2021-09-30 17:54:40 +0200
committersonartech <sonartech@sonarsource.com>2021-10-01 20:03:19 +0000
commit22be6f79ed4c8446fd1298e5eb6b45bb9222d225 (patch)
tree5918789e051c8fdfced57aa65770c1e29545a899 /server/sonar-docs/src/__tests__
parent95ee805a4c7e0e750acaf2d718ec68a71c7e0892 (diff)
downloadsonarqube-22be6f79ed4c8446fd1298e5eb6b45bb9222d225.tar.gz
sonarqube-22be6f79ed4c8446fd1298e5eb6b45bb9222d225.zip
SONAR-15466 Add link for SonarLint connected mode
Diffstat (limited to 'server/sonar-docs/src/__tests__')
-rw-r--r--server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js b/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js
index d1d31eb30c9..74c4598bd57 100644
--- a/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js
+++ b/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js
@@ -72,16 +72,19 @@ it('should have valid links in trees files', () => {
it('should have valid links in suggestions file', () => {
const file = 'EmbedDocsSuggestions.json';
const suggestions = JSON.parse(fs.readFileSync(path.join(rootPath, file), 'utf8'));
- let hasErrors = false;
- Object.keys(suggestions).forEach(key => {
- suggestions[key].forEach(suggestion => {
+ const hasErrors = Object.keys(suggestions).some(key => {
+ return suggestions[key].some(suggestion => {
if (!suggestion.link.startsWith('/documentation/')) {
- console.log(`[${suggestion.link}] should starts with "/documentation/", in ${file}`);
- hasErrors = true;
- } else if (!urlExists(parsedFiles, suggestion.link.replace('/documentation', ''))) {
+ console.log(
+ `[${suggestion.link}] should starts with "/documentation/" or be a valid url, in ${file}`
+ );
+ return true;
+ }
+ if (!urlExists(parsedFiles, suggestion.link.replace('/documentation', ''))) {
console.log(`[${suggestion.link}] is not a valid link, in ${file}`);
- hasErrors = true;
+ return true;
}
+ return false;
});
});
expect(hasErrors).toBe(false);