Skip to content

Commit f42612d

Browse files
committed
test: add unit test cases of customize style for folder-naming-convention rule
1 parent 0e2487d commit f42612d

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

tests/lib/rules/folder-naming-convention.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,48 @@ ruleTester.run(
9595
}
9696
);
9797

98-
// custom rule
98+
ruleTester.run(
99+
"folder-naming-convention with option: [{ 'components/*/': '__+([a-z])' }]",
100+
rule,
101+
{
102+
valid: [
103+
{
104+
code: "var foo = 'bar';",
105+
filename: 'src/components/__displaylabel/index.js',
106+
options: [{ 'components/*/': '__+([a-z])' }],
107+
},
108+
],
109+
110+
invalid: [
111+
{
112+
code: "var foo = 'bar';",
113+
filename: 'src/components/_displayLabel/index.js',
114+
options: [{ 'components/*/': '__+([a-z])' }],
115+
errors: [
116+
{
117+
message:
118+
'The folder "_displayLabel" does not match the "__+([a-z])" style',
119+
column: 1,
120+
line: 1,
121+
},
122+
],
123+
},
124+
{
125+
code: "var foo = 'bar';",
126+
filename: 'src/components/__displayLabel/index.js',
127+
options: [{ 'components/*/': '__+([a-z])' }],
128+
errors: [
129+
{
130+
message:
131+
'The folder "__displayLabel" does not match the "__+([a-z])" style',
132+
column: 1,
133+
line: 1,
134+
},
135+
],
136+
},
137+
],
138+
}
139+
);
99140

100141
ruleTester.run(
101142
'folder-naming-convention with folder that has not been set',

0 commit comments

Comments
 (0)