1+ import { dateFilterArgs } from '../_shared-args.ts' ;
12import { dailyCommand } from './daily.ts' ;
23import { monthlyCommand } from './monthly.ts' ;
34import { sessionCommand } from './session.ts' ;
45import { weeklyCommand } from './weekly.ts' ;
56
6- export { dailyCommand } from './daily.ts' ;
7- export { monthlyCommand } from './monthly.ts' ;
8- export { sessionCommand } from './session.ts' ;
9- export { weeklyCommand } from './weekly.ts' ;
7+ export { dailyCommand , monthlyCommand , sessionCommand , weeklyCommand } ;
108
119if ( import . meta. vitest != null ) {
1210 const { describe, expect, it } = import . meta. vitest ;
1311
1412 type DateArg = {
15- short : string ;
16- description : string ;
17- parse : ( value : string ) => string ;
13+ readonly short : string ;
14+ readonly description : string ;
15+ readonly parse : ( value : string ) => string ;
1816 } ;
1917 type CommandWithDateArgs = {
2018 args : {
@@ -29,18 +27,11 @@ if (import.meta.vitest != null) {
2927 [ 'weekly' , weeklyCommand ] ,
3028 [ 'monthly' , monthlyCommand ] ,
3129 [ 'session' , sessionCommand ] ,
32- ] ) ( 'should expose main-mode compatible since and until args for %s' , ( _name , command ) => {
30+ ] ) ( 'should expose shared since and until args for %s' , ( _name , command ) => {
3331 const args = ( command as CommandWithDateArgs ) . args ;
3432
35- expect ( args . since ?. short ) . toBe ( 's' ) ;
36- expect ( args . since ?. description ) . toBe ( 'Filter from date (YYYYMMDD format)' ) ;
37- expect ( args . since ?. parse ( '20240102' ) ) . toBe ( '20240102' ) ;
38- expect ( ( ) => args . since ?. parse ( '2024-01-02' ) ) . toThrow ( 'Date must be in YYYYMMDD format' ) ;
39-
40- expect ( args . until ?. short ) . toBe ( 'u' ) ;
41- expect ( args . until ?. description ) . toBe ( 'Filter until date (YYYYMMDD format)' ) ;
42- expect ( args . until ?. parse ( '20240103' ) ) . toBe ( '20240103' ) ;
43- expect ( ( ) => args . until ?. parse ( '2024-01-03' ) ) . toThrow ( 'Date must be in YYYYMMDD format' ) ;
33+ expect ( args . since ) . toBe ( dateFilterArgs . since ) ;
34+ expect ( args . until ) . toBe ( dateFilterArgs . until ) ;
4435 } ) ;
4536 } ) ;
4637}
0 commit comments