@@ -46,10 +46,13 @@ vi.mock("../cli/spinners.ts", () => ({
46
46
} ,
47
47
} ) ) ;
48
48
49
+ const mockAugmentOptionsWithExcludes = vi . fn ( ) ;
50
+
49
51
vi . mock ( "./augmentOptionsWithExcludes.js" , ( ) => ( {
50
- augmentOptionsWithExcludes ( ) {
51
- return { ... emptyOptions , ... mockOptions } ;
52
+ get augmentOptionsWithExcludes ( ) {
53
+ return mockAugmentOptionsWithExcludes ;
52
54
} ,
55
+ // return { ...emptyOptions, ...mockOptions };
53
56
} ) ) ;
54
57
55
58
const mockDetectEmailRedundancy = vi . fn ( ) ;
@@ -263,7 +266,37 @@ describe("readOptions", () => {
263
266
} ) ;
264
267
} ) ;
265
268
269
+ it ( "returns a cancellation when augmentOptionsWithExcludes returns undefined" , async ( ) => {
270
+ mockDetectEmailRedundancy . mockReturnValue ( false ) ;
271
+ mockGetPrefillOrPromptedOption
272
+ . mockImplementationOnce ( ( ) => "MockOwner" )
273
+ . mockImplementationOnce ( ( ) => "MockRepository" )
274
+ . mockImplementationOnce ( ( ) => "Mock description." )
275
+ . mockImplementationOnce ( ( ) => "Mock title." )
276
+ . mockImplementation ( ( ) => undefined ) ;
277
+ mockEnsureRepositoryExists . mockResolvedValue ( {
278
+ github : mockOptions . github ,
279
+ repository : mockOptions . repository ,
280
+ } ) ;
281
+ mockAugmentOptionsWithExcludes . mockResolvedValue ( undefined ) ;
282
+
283
+ expect ( await readOptions ( [ ] ) ) . toStrictEqual ( {
284
+ cancelled : true ,
285
+ options : {
286
+ ...emptyOptions ,
287
+ description : "Mock description." ,
288
+ owner : "MockOwner" ,
289
+ repository : "MockRepository" ,
290
+ title : "Mock title." ,
291
+ } ,
292
+ } ) ;
293
+ } ) ;
294
+
266
295
it ( "returns success options when --base is valid" , async ( ) => {
296
+ mockAugmentOptionsWithExcludes . mockResolvedValue ( {
297
+ ...emptyOptions ,
298
+ ...mockOptions ,
299
+ } ) ;
267
300
mockGetPrefillOrPromptedOption . mockImplementation ( ( ) => "mock" ) ;
268
301
269
302
expect ( await readOptions ( [ "--base" , mockOptions . base ] ) ) . toStrictEqual ( {
0 commit comments