@@ -50,6 +50,7 @@ test('returns error when input file cannot be read', async () => {
5050 showProgress : false ,
5151 shouldStream : false ,
5252 unsafeFakerExpressions : false ,
53+ pairwise : false ,
5354 } ,
5455 } ) ;
5556 expect ( code ) . toBe ( 1 ) ;
@@ -69,6 +70,7 @@ test('writes output file in buffered mode', async () => {
6970 showProgress : false ,
7071 shouldStream : false ,
7172 unsafeFakerExpressions : false ,
73+ pairwise : false ,
7274 } ,
7375 } ) ;
7476 expect ( code ) . toBe ( 0 ) ;
@@ -96,9 +98,82 @@ test('returns error when stream writer fails', async () => {
9698 showProgress : false ,
9799 shouldStream : true ,
98100 unsafeFakerExpressions : false ,
101+ pairwise : false ,
99102 } ,
100103 } ) ;
101104
102105 expect ( code ) . toBe ( 1 ) ;
103106 expect ( platform . err . join ( '' ) ) . toContain ( 'Streaming generation failed' ) ;
104107} ) ;
108+
109+ test ( 'ignores stream mode when pairwise is requested' , async ( ) => {
110+ const platform = makePlatform ( { textSpec : 'Browser\nChrome,Firefox,Safari\nTheme\nLight,Dark' } ) ;
111+ const code = await runCliCommand ( {
112+ platform,
113+ options : {
114+ inputFile : 'spec.txt' ,
115+ outputFile : 'out.csv' ,
116+ format : 'csv' ,
117+ rowCount : 2 ,
118+ testMode : false ,
119+ showProgress : false ,
120+ shouldStream : true ,
121+ unsafeFakerExpressions : false ,
122+ pairwise : true ,
123+ } ,
124+ } ) ;
125+ expect ( code ) . toBe ( 0 ) ;
126+ expect ( platform . err . join ( '' ) ) . toBe ( '' ) ;
127+ expect ( platform . writes . length ) . toBe ( 1 ) ;
128+ expect ( platform . writes [ 0 ] . path ) . toBe ( 'out.csv' ) ;
129+ } ) ;
130+
131+ test ( 'reports warning in test mode when stream mode is ignored for pairwise' , async ( ) => {
132+ const platform = makePlatform ( { textSpec : 'Browser\nChrome,Firefox,Safari\nTheme\nLight,Dark' } ) ;
133+ const code = await runCliCommand ( {
134+ platform,
135+ options : {
136+ inputFile : 'spec.txt' ,
137+ outputFile : 'out.csv' ,
138+ format : 'csv' ,
139+ rowCount : 2 ,
140+ testMode : true ,
141+ showProgress : true ,
142+ shouldStream : true ,
143+ unsafeFakerExpressions : false ,
144+ pairwise : true ,
145+ } ,
146+ } ) ;
147+ expect ( code ) . toBe ( 0 ) ;
148+ expect ( platform . out . join ( '' ) ) . toContain ( 'WARNING: Streaming is ignored when pairwise generation is enabled' ) ;
149+ expect ( platform . out . join ( '' ) ) . toContain ( 'WARNING: rowCount is ignored when pairwise generation is enabled.' ) ;
150+ } ) ;
151+
152+ test ( 'generates deterministic pairwise output in buffered mode' , async ( ) => {
153+ const platform = makePlatform ( { textSpec : 'Browser\nChrome,Firefox,Safari\nTheme\nLight,Dark' } ) ;
154+ const code = await runCliCommand ( {
155+ platform,
156+ options : {
157+ inputFile : 'spec.txt' ,
158+ outputFile : null ,
159+ format : 'json' ,
160+ rowCount : 100 ,
161+ testMode : false ,
162+ showProgress : false ,
163+ shouldStream : false ,
164+ unsafeFakerExpressions : false ,
165+ pairwise : true ,
166+ } ,
167+ } ) ;
168+
169+ expect ( code ) . toBe ( 0 ) ;
170+ const rendered = platform . out . join ( '' ) . trim ( ) ;
171+ expect ( JSON . parse ( rendered ) ) . toEqual ( [
172+ { Browser : 'Chrome' , Theme : 'Light' } ,
173+ { Browser : 'Chrome' , Theme : 'Dark' } ,
174+ { Browser : 'Firefox' , Theme : 'Light' } ,
175+ { Browser : 'Firefox' , Theme : 'Dark' } ,
176+ { Browser : 'Safari' , Theme : 'Light' } ,
177+ { Browser : 'Safari' , Theme : 'Dark' } ,
178+ ] ) ;
179+ } ) ;
0 commit comments