Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions packages/edge/src/commands/edge/channels/assign.ts

This file was deleted.

73 changes: 0 additions & 73 deletions packages/edge/src/commands/edge/channels/unassign.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/__tests__/commands/edge/channels/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ test('handler', async () => {
await expect(cmd.handler(inputArgv)).resolves.not.toThrow()

expect(apiCommandMock).toHaveBeenCalledExactlyOnceWith(inputArgv)
expect(chooseChannelMock).toHaveBeenCalledExactlyOnceWith(command, 'Choose a channel to delete.', 'cmd-line-id')
expect(chooseChannelMock).toHaveBeenCalledExactlyOnceWith(
command,
'cmd-line-id',
{ promptMessage: 'Choose a channel to delete.' },
)
expect(apiChannelsDeleteMock).toHaveBeenCalledExactlyOnceWith('chosen-channel-id')
expect(resetManagedConfigKeyMock).toHaveBeenCalledExactlyOnceWith(cliConfig, 'defaultChannel', expect.any(Function))
expect(consoleLogSpy).toHaveBeenCalledWith('Channel chosen-channel-id deleted.')
Expand Down
17 changes: 11 additions & 6 deletions src/__tests__/commands/edge/channels/drivers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import type { ArgumentsCamelCase, Argv } from 'yargs'
import type { CommandArgs } from '../../../../commands/edge/channels/drivers.js'
import type { APICommand, APICommandFlags } from '../../../../lib/command/api-command.js'
import type { outputList, outputListBuilder } from '../../../../lib/command/output-list.js'
import type { DriverChannelDetailsWithName, listAssignedDriversWithNames } from '../../../../lib/command/util/edge-drivers.js'
import type { chooseChannel } from '../../../../lib/command/util/edge/channels-choose.js'
import type {
DriverChannelDetailsWithName,
listAssignedDriversWithNames,
} from '../../../../lib/command/util/edge-drivers.js'
import type { ChooseFunction } from '../../../../lib/command/util/util-util.js'
import type { ChannelChoice, chooseChannelFn } from '../../../../lib/command/util/edge/channels-choose.js'
import { apiCommandMocks } from '../../../test-lib/api-command-mock.js'
import { buildArgvMock, buildArgvMockStub } from '../../../test-lib/builder-mock.js'

Expand All @@ -25,9 +29,10 @@ jest.unstable_mockModule('../../../../lib/command/util/edge-drivers.js', () => (
listAssignedDriversWithNames: listAssignedDriversWithNamesMock,
}))

const chooseChannelMock = jest.fn<typeof chooseChannel>()
const chooseChannelMock = jest.fn<ChooseFunction<ChannelChoice>>()
const chooseChannelFnMock = jest.fn<typeof chooseChannelFn>().mockReturnValue(chooseChannelMock)
jest.unstable_mockModule('../../../../lib/command/util/edge/channels-choose.js', () => ({
chooseChannel: chooseChannelMock,
chooseChannelFn: chooseChannelFnMock,
}))


Expand Down Expand Up @@ -74,11 +79,11 @@ test('handler', async () => {
await expect(cmd.handler(inputArgv)).resolves.not.toThrow()

expect(apiCommandMock).toHaveBeenCalledExactlyOnceWith(inputArgv)
expect(chooseChannelFnMock).toHaveBeenCalledExactlyOnceWith({ includeReadOnly: true })
expect(chooseChannelMock).toHaveBeenCalledExactlyOnceWith(
command,
'Select a channel.',
'cmd-line-id',
{ allowIndex: true, includeReadOnly: true, useConfigDefault: true },
{ allowIndex: true, useConfigDefault: true },
)
expect(outputListMock).toHaveBeenCalledExactlyOnceWith(
command,
Expand Down
Loading