@@ -38,45 +38,18 @@ describe("formatBanner", () => {
3838describe ( "printCustomHelp" , ( ) => {
3939 useTestConfigDir ( "help-test-" ) ;
4040
41- test ( "writes output to the provided writer" , async ( ) => {
42- const chunks : string [ ] = [ ] ;
43- const writer = {
44- write : ( s : string ) => {
45- chunks . push ( s ) ;
46- return true ;
47- } ,
48- } ;
49-
50- await printCustomHelp ( writer ) ;
51- expect ( chunks . length ) . toBeGreaterThan ( 0 ) ;
52- expect ( chunks . join ( "" ) . length ) . toBeGreaterThan ( 0 ) ;
41+ test ( "returns non-empty string" , async ( ) => {
42+ const output = await printCustomHelp ( ) ;
43+ expect ( output . length ) . toBeGreaterThan ( 0 ) ;
5344 } ) ;
5445
5546 test ( "output contains the tagline" , async ( ) => {
56- const chunks : string [ ] = [ ] ;
57- const writer = {
58- write : ( s : string ) => {
59- chunks . push ( s ) ;
60- return true ;
61- } ,
62- } ;
63-
64- await printCustomHelp ( writer ) ;
65- const output = stripAnsi ( chunks . join ( "" ) ) ;
47+ const output = stripAnsi ( await printCustomHelp ( ) ) ;
6648 expect ( output ) . toContain ( "The command-line interface for Sentry" ) ;
6749 } ) ;
6850
6951 test ( "output contains registered commands" , async ( ) => {
70- const chunks : string [ ] = [ ] ;
71- const writer = {
72- write : ( s : string ) => {
73- chunks . push ( s ) ;
74- return true ;
75- } ,
76- } ;
77-
78- await printCustomHelp ( writer ) ;
79- const output = stripAnsi ( chunks . join ( "" ) ) ;
52+ const output = stripAnsi ( await printCustomHelp ( ) ) ;
8053
8154 // Should include at least some core commands from routes
8255 expect ( output ) . toContain ( "sentry" ) ;
@@ -87,31 +60,13 @@ describe("printCustomHelp", () => {
8760 } ) ;
8861
8962 test ( "output contains docs URL" , async ( ) => {
90- const chunks : string [ ] = [ ] ;
91- const writer = {
92- write : ( s : string ) => {
93- chunks . push ( s ) ;
94- return true ;
95- } ,
96- } ;
97-
98- await printCustomHelp ( writer ) ;
99- const output = stripAnsi ( chunks . join ( "" ) ) ;
63+ const output = stripAnsi ( await printCustomHelp ( ) ) ;
10064 expect ( output ) . toContain ( "cli.sentry.dev" ) ;
10165 } ) ;
10266
10367 test ( "shows login example when not authenticated" , async ( ) => {
10468 // useTestConfigDir provides a clean env with no auth token
105- const chunks : string [ ] = [ ] ;
106- const writer = {
107- write : ( s : string ) => {
108- chunks . push ( s ) ;
109- return true ;
110- } ,
111- } ;
112-
113- await printCustomHelp ( writer ) ;
114- const output = stripAnsi ( chunks . join ( "" ) ) ;
69+ const output = stripAnsi ( await printCustomHelp ( ) ) ;
11570 expect ( output ) . toContain ( "sentry auth login" ) ;
11671 } ) ;
11772} ) ;
0 commit comments