Skip to content

Commit 489f339

Browse files
committed
test(#23): add test cases for rule filename-naming-convention with NEXT_JS_APP_ROUTER_CASE
1 parent 0804431 commit 489f339

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

tests/lib/rules/filename-naming-convention.posix.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,30 @@ ruleTester.run(
802802
}
803803
);
804804

805+
ruleTester.run(
806+
"filename-naming-convention with option: [{ '**/*.js': 'NEXT_JS_APP_ROUTER_CASE' }]",
807+
rule,
808+
{
809+
valid: [],
810+
811+
invalid: [
812+
{
813+
code: "var foo = 'bar';",
814+
filename: 'src/utils/calculatePrice.js',
815+
options: [{ '**/*.js': 'NEXT_JS_APP_ROUTER_CASE' }],
816+
errors: [
817+
{
818+
message:
819+
'There is an invalid pattern "NEXT_JS_APP_ROUTER_CASE", please double-check it and try again',
820+
column: 1,
821+
line: 1,
822+
},
823+
],
824+
},
825+
],
826+
}
827+
);
828+
805829
ruleTester.run(
806830
"filename-naming-convention with option: [{ 'src/services/*.js': 'PASCAL_CASE', 'src/composables/*.js': 'CAMEL_CASE' }]",
807831
rule,

tests/lib/rules/filename-naming-convention.windows.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,30 @@ ruleTester.run(
571571
}
572572
);
573573

574+
ruleTester.run(
575+
"filename-naming-convention with option on Windows: [{ '**/*.js': 'NEXT_JS_APP_ROUTER_CASE' }]",
576+
rule,
577+
{
578+
valid: [],
579+
580+
invalid: [
581+
{
582+
code: "var foo = 'bar';",
583+
filename: 'src\\utils\\calculatePrice.js',
584+
options: [{ '**/*.js': 'NEXT_JS_APP_ROUTER_CASE' }],
585+
errors: [
586+
{
587+
message:
588+
'There is an invalid pattern "NEXT_JS_APP_ROUTER_CASE", please double-check it and try again',
589+
column: 1,
590+
line: 1,
591+
},
592+
],
593+
},
594+
],
595+
}
596+
);
597+
574598
ruleTester.run(
575599
"filename-naming-convention with option on Windows: [{ 'src/services/*.js': 'PASCAL_CASE', 'src/composables/*.js': 'CAMEL_CASE' }]",
576600
rule,

0 commit comments

Comments
 (0)