@@ -5,8 +5,12 @@ import type { ArgumentsCamelCase, Argv } from 'yargs'
55import type { CommandArgs } from '../../../../commands/edge/channels/drivers.js'
66import type { APICommand , APICommandFlags } from '../../../../lib/command/api-command.js'
77import type { outputList , outputListBuilder } from '../../../../lib/command/output-list.js'
8- import type { DriverChannelDetailsWithName , listAssignedDriversWithNames } from '../../../../lib/command/util/edge-drivers.js'
9- import type { chooseChannel } from '../../../../lib/command/util/edge/channels-choose.js'
8+ import type {
9+ DriverChannelDetailsWithName ,
10+ listAssignedDriversWithNames ,
11+ } from '../../../../lib/command/util/edge-drivers.js'
12+ import type { ChooseFunction } from '../../../../lib/command/util/util-util.js'
13+ import type { ChannelChoice , chooseChannelFn } from '../../../../lib/command/util/edge/channels-choose.js'
1014import { apiCommandMocks } from '../../../test-lib/api-command-mock.js'
1115import { buildArgvMock , buildArgvMockStub } from '../../../test-lib/builder-mock.js'
1216
@@ -25,9 +29,10 @@ jest.unstable_mockModule('../../../../lib/command/util/edge-drivers.js', () => (
2529 listAssignedDriversWithNames : listAssignedDriversWithNamesMock ,
2630} ) )
2731
28- const chooseChannelMock = jest . fn < typeof chooseChannel > ( )
32+ const chooseChannelMock = jest . fn < ChooseFunction < ChannelChoice > > ( )
33+ const chooseChannelFnMock = jest . fn < typeof chooseChannelFn > ( ) . mockReturnValue ( chooseChannelMock )
2934jest . unstable_mockModule ( '../../../../lib/command/util/edge/channels-choose.js' , ( ) => ( {
30- chooseChannel : chooseChannelMock ,
35+ chooseChannelFn : chooseChannelFnMock ,
3136} ) )
3237
3338
@@ -74,11 +79,11 @@ test('handler', async () => {
7479 await expect ( cmd . handler ( inputArgv ) ) . resolves . not . toThrow ( )
7580
7681 expect ( apiCommandMock ) . toHaveBeenCalledExactlyOnceWith ( inputArgv )
82+ expect ( chooseChannelFnMock ) . toHaveBeenCalledExactlyOnceWith ( { includeReadOnly : true } )
7783 expect ( chooseChannelMock ) . toHaveBeenCalledExactlyOnceWith (
7884 command ,
79- 'Select a channel.' ,
8085 'cmd-line-id' ,
81- { allowIndex : true , includeReadOnly : true , useConfigDefault : true } ,
86+ { allowIndex : true , useConfigDefault : true } ,
8287 )
8388 expect ( outputListMock ) . toHaveBeenCalledExactlyOnceWith (
8489 command ,
0 commit comments