@@ -11,11 +11,13 @@ describe("Command Utilities", () => {
1111 const testCwd = "/test/project"
1212
1313 describe ( "getCommandNameFromFile" , ( ) => {
14- it ( "should strip all extensions from filename " , ( ) => {
14+ it ( "should strip .md extension only " , ( ) => {
1515 expect ( getCommandNameFromFile ( "my-command.md" ) ) . toBe ( "my-command" )
16- expect ( getCommandNameFromFile ( "test.txt" ) ) . toBe ( "test" )
16+ expect ( getCommandNameFromFile ( "test.txt" ) ) . toBe ( "test.txt " )
1717 expect ( getCommandNameFromFile ( "no-extension" ) ) . toBe ( "no-extension" )
18- expect ( getCommandNameFromFile ( "multiple.dots.file.md" ) ) . toBe ( "multiple" )
18+ expect ( getCommandNameFromFile ( "multiple.dots.file.md" ) ) . toBe ( "multiple.dots.file" )
19+ expect ( getCommandNameFromFile ( "api.config.md" ) ) . toBe ( "api.config" )
20+ expect ( getCommandNameFromFile ( "deploy_prod.md" ) ) . toBe ( "deploy_prod" )
1921 } )
2022 } )
2123
@@ -64,14 +66,14 @@ describe("Command Utilities", () => {
6466 expect ( getCommandNameFromFile ( "command" ) ) . toBe ( "command" )
6567 expect ( getCommandNameFromFile ( "my-command" ) ) . toBe ( "my-command" )
6668
67- // Files with multiple dots - only strip first extension
68- expect ( getCommandNameFromFile ( "my.complex.command.md" ) ) . toBe ( "my" )
69- expect ( getCommandNameFromFile ( "v1.2.3.txt" ) ) . toBe ( "v1" )
69+ // Files with multiple dots - only strip .md extension
70+ expect ( getCommandNameFromFile ( "my.complex.command.md" ) ) . toBe ( "my.complex.command " )
71+ expect ( getCommandNameFromFile ( "v1.2.3.txt" ) ) . toBe ( "v1.2.3.txt " )
7072
7173 // Edge cases
72- expect ( getCommandNameFromFile ( "." ) ) . toBe ( "" )
73- expect ( getCommandNameFromFile ( ".." ) ) . toBe ( "" )
74- expect ( getCommandNameFromFile ( ".hidden.md" ) ) . toBe ( "" )
74+ expect ( getCommandNameFromFile ( "." ) ) . toBe ( ". " )
75+ expect ( getCommandNameFromFile ( ".." ) ) . toBe ( ".. " )
76+ expect ( getCommandNameFromFile ( ".hidden.md" ) ) . toBe ( ".hidden " )
7577 } )
7678 } )
7779
0 commit comments