@@ -9,7 +9,11 @@ describe("GH002: No Generic Link Text", () => {
9
9
"[Read more about GitHub](https://www.github.com/about)" ,
10
10
"[](www.github.com)" ,
11
11
"" ,
12
- "I am not a link, and unrelated" ,
12
+ `
13
+ ## Hello
14
+ I am not a link, and unrelated.
15
+ 
16
+ ` ,
13
17
] ;
14
18
15
19
const results = await runTest ( strings , noGenericLinkTextRule ) ;
@@ -20,12 +24,13 @@ describe("GH002: No Generic Link Text", () => {
20
24
} ) ;
21
25
} ) ;
22
26
describe ( "failures" , ( ) => {
23
- test ( "markdown example " , async ( ) => {
27
+ test ( "inline " , async ( ) => {
24
28
const strings = [
25
29
"[Click here](www.github.com)" ,
26
30
"[here](www.github.com)" ,
27
31
"Please [read more](www.github.com)" ,
28
32
"[more](www.github.com)" ,
33
+ "[link](www.github.com)" ,
29
34
"You may [learn more](www.github.com) at GitHub" ,
30
35
"[learn more.](www.github.com)" ,
31
36
"[click here!](www.github.com)" ,
@@ -38,10 +43,26 @@ describe("GH002: No Generic Link Text", () => {
38
43
. flat ( )
39
44
. filter ( ( name ) => ! name . includes ( "GH" ) ) ;
40
45
41
- expect ( failedRules ) . toHaveLength ( 7 ) ;
46
+ expect ( failedRules ) . toHaveLength ( 8 ) ;
42
47
for ( const rule of failedRules ) {
43
48
expect ( rule ) . toBe ( "no-generic-link-text" ) ;
44
49
}
45
50
} ) ;
51
+
52
+ test ( "additional words can be configured" , async ( ) => {
53
+ const results = await runTest (
54
+ [ "[something](www.github.com)" ] ,
55
+ noGenericLinkTextRule ,
56
+ // eslint-disable-next-line camelcase
57
+ { additional_banned_texts : [ "something" ] }
58
+ ) ;
59
+
60
+ const failedRules = results
61
+ . map ( ( result ) => result . ruleNames )
62
+ . flat ( )
63
+ . filter ( ( name ) => ! name . includes ( "GH" ) ) ;
64
+
65
+ expect ( failedRules ) . toHaveLength ( 1 ) ;
66
+ } ) ;
46
67
} ) ;
47
68
} ) ;
0 commit comments