Skip to content

Commit

Permalink
test: fix unexpected arguments errors
Browse files Browse the repository at this point in the history
- related to oclif/core#330
  • Loading branch information
john-u committed Dec 30, 2021
1 parent 1d600f6 commit 233625f
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/apps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('AppsCommand', () => {
})

it('calls outputListing with correct config', async () => {
await expect(AppsCommand.run()).resolves.not.toThrow()
await expect(AppsCommand.run([])).resolves.not.toThrow()

expect(outputListing).toBeCalledWith(
expect.any(AppsCommand),
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('AppsCommand', () => {
})

it('calls correct list endpoint', async () => {
await expect(AppsCommand.run()).resolves.not.toThrow()
await expect(AppsCommand.run([])).resolves.not.toThrow()
expect(listSpy).toBeCalled()
})

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/apps/authorize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('AppsAuthorizeCommand', () => {
})

it('requires ARN arg', async () => {
await expect(AppsAuthorizeCommand.run()).rejects.toThrow('Missing 1 required arg:\narn')
await expect(AppsAuthorizeCommand.run([])).rejects.toThrow('Missing 1 required arg:\narn')
})

it('calls addPermission with required ARN', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/apps/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('AppCreateCommand', () => {
})
const buildTableSpy = jest.spyOn(DefaultTableGenerator.prototype, 'buildTableFromItem')

await expect(AppCreateCommand.run()).resolves.not.toThrow()
await expect(AppCreateCommand.run([])).resolves.not.toThrow()

expect(mockInputOutput).toBeCalledWith(
expect.any(AppCreateCommand),
Expand All @@ -55,7 +55,7 @@ describe('AppCreateCommand', () => {
await actionFunction(undefined, appRequest)
})

await expect(AppCreateCommand.run()).resolves.not.toThrow()
await expect(AppCreateCommand.run([])).resolves.not.toThrow()

expect(createSpy).toBeCalledWith(appRequest)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/apps/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('AppDeleteCommand', () => {
})

it('prompts user to choose app', async () => {
await expect(AppDeleteCommand.run()).resolves.not.toThrow()
await expect(AppDeleteCommand.run([])).resolves.not.toThrow()

expect(chooseApp).toBeCalledWith(expect.any(AppDeleteCommand), undefined)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/apps/oauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('AppOauthCommand', () => {
})

it('prompts user to choose app allowing index', async () => {
await expect(AppOauthCommand.run()).resolves.not.toThrow()
await expect(AppOauthCommand.run([])).resolves.not.toThrow()

expect(mockChooseApp).toBeCalledWith(
expect.any(AppOauthCommand),
Expand All @@ -42,7 +42,7 @@ describe('AppOauthCommand', () => {
})

it('calls outputItem with correct config', async () => {
await expect(AppOauthCommand.run()).resolves.not.toThrow()
await expect(AppOauthCommand.run([])).resolves.not.toThrow()

expect(mockOutput).toBeCalledWith(
expect.any(AppOauthCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ describe('AppOauthGenerateCommand', () => {
})

it('prompts user to choose app', async () => {
await expect(AppOauthGenerateCommand.run()).resolves.not.toThrow()
await expect(AppOauthGenerateCommand.run([])).resolves.not.toThrow()

expect(mockChooseApp).toBeCalledWith(expect.any(AppOauthGenerateCommand), undefined)
})

it('calls inputOutput with correct config', async () => {
await expect(AppOauthGenerateCommand.run()).resolves.not.toThrow()
await expect(AppOauthGenerateCommand.run([])).resolves.not.toThrow()

expect(mockInputOutput).toBeCalledWith(
expect.any(AppOauthGenerateCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('AppOauthUpdateCommand', () => {
})

it('prompts user to choose app', async () => {
await expect(AppOauthUpdateCommand.run()).resolves.not.toThrow()
await expect(AppOauthUpdateCommand.run([])).resolves.not.toThrow()

expect(mockChooseApp).toBeCalledWith(expect.any(AppOauthUpdateCommand), undefined)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/apps/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('AppRegisterCommand', () => {
})

it('calls selectFromList with correct config', async () => {
await expect(AppRegisterCommand.run()).resolves.not.toThrow()
await expect(AppRegisterCommand.run([])).resolves.not.toThrow()

expect(mockSelectFromList).toBeCalledWith(
expect.any(AppRegisterCommand),
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('AppRegisterCommand', () => {
return apps
})

await expect(AppRegisterCommand.run()).resolves.not.toThrow()
await expect(AppRegisterCommand.run([])).resolves.not.toThrow()

const listFunction = mockSelectFromList.mock.calls[0][3]
await expect(listFunction()).resolves.toEqual(webhookApps.concat(apiOnlyApps))
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/__tests__/commands/apps/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('AppSettingsCommand', () => {
})

it('prompts user to choose app allowing index', async () => {
await expect(AppSettingsCommand.run()).resolves.not.toThrow()
await expect(AppSettingsCommand.run([])).resolves.not.toThrow()

expect(chooseApp).toBeCalledWith(
expect.any(AppSettingsCommand),
Expand All @@ -53,7 +53,7 @@ describe('AppSettingsCommand', () => {
return appSettings
})

await expect(AppSettingsCommand.run()).resolves.not.toThrow()
await expect(AppSettingsCommand.run([])).resolves.not.toThrow()

expect(outputItem).toBeCalledWith(
expect.any(AppSettingsCommand),
Expand All @@ -76,7 +76,7 @@ describe('AppSettingsCommand', () => {
})
mockChooseApp.mockResolvedValueOnce(appId)

await expect(AppSettingsCommand.run()).resolves.not.toThrow()
await expect(AppSettingsCommand.run([])).resolves.not.toThrow()

expect(settingsSpy).toBeCalledWith(appId)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('AppSettingsUpdateCommand', () => {
})

it('prompts user to choose app', async () => {
await expect(AppSettingsUpdateCommand.run()).resolves.not.toThrow()
await expect(AppSettingsUpdateCommand.run([])).resolves.not.toThrow()

expect(mockChooseApp).toBeCalledWith(expect.any(AppSettingsUpdateCommand), undefined)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/apps/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('AppUpdateCommand', () => {
})

it('prompts user to choose app', async () => {
await expect(AppUpdateCommand.run()).resolves.not.toThrow()
await expect(AppUpdateCommand.run([])).resolves.not.toThrow()

expect(chooseApp).toBeCalledWith(
expect.any(AppUpdateCommand),
Expand All @@ -55,7 +55,7 @@ describe('AppUpdateCommand', () => {
})

it('calls inputOutput with correct config', async () => {
await expect(AppUpdateCommand.run()).resolves.not.toThrow()
await expect(AppUpdateCommand.run([])).resolves.not.toThrow()

expect(mockInputOutput).toBeCalledWith(
expect.any(AppUpdateCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('DevicePreferencesTranslationsCommand', () => {
})

it('prompts user to choose device preference', async () => {
await expect(DevicePreferencesTranslationsCommand.run()).resolves.not.toThrow()
await expect(DevicePreferencesTranslationsCommand.run([])).resolves.not.toThrow()

expect(chooseDevicePreference).toBeCalledWith(
expect.any(DevicePreferencesTranslationsCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('DevicePreferencesTranslationsCreateCommand', () => {
})

it('prompts user to choose device preference', async () => {
await expect(DevicePreferencesTranslationsCreateCommand.run()).resolves.not.toThrow()
await expect(DevicePreferencesTranslationsCreateCommand.run([])).resolves.not.toThrow()

expect(chooseDevicePreference).toBeCalledWith(
expect.any(DevicePreferencesTranslationsCreateCommand),
Expand All @@ -47,7 +47,7 @@ describe('DevicePreferencesTranslationsCreateCommand', () => {
})

it('calls inputOutput with correct config', async () => {
await expect(DevicePreferencesTranslationsCreateCommand.run()).resolves.not.toThrow()
await expect(DevicePreferencesTranslationsCreateCommand.run([])).resolves.not.toThrow()

expect(mockInputOutput).toBeCalledWith(
expect.any(DevicePreferencesTranslationsCreateCommand),
Expand All @@ -63,7 +63,7 @@ describe('DevicePreferencesTranslationsCreateCommand', () => {
return actionFunction(undefined, MOCK_PREFERENCE_L10N)
})

await expect(DevicePreferencesTranslationsCreateCommand.run()).resolves.not.toThrow()
await expect(DevicePreferencesTranslationsCreateCommand.run([])).resolves.not.toThrow()

expect(createTranslationsSpy).toBeCalledWith(preferenceId, MOCK_PREFERENCE_L10N)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/devices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('devices', () => {
const outputListingMock = outputListing as unknown as jest.Mock<typeof outputListing>

it('passes undefined for location id when not specified', async () => {
await expect(DevicesCommand.run()).resolves.not.toThrow()
await expect(DevicesCommand.run([])).resolves.not.toThrow()

expect(outputListingMock).toHaveBeenCalledTimes(1)
expect(outputListingMock.mock.calls[0][2]).toBeUndefined()
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/locations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('LocationsCommand', () => {
})

it('calls outputListing when no id is provided', async () => {
await expect(LocationsCommand.run()).resolves.not.toThrow()
await expect(LocationsCommand.run([])).resolves.not.toThrow()

expect(mockListing).toBeCalledTimes(1)
expect(mockListing.mock.calls[0][2]).toBeUndefined()
Expand All @@ -79,7 +79,7 @@ describe('LocationsCommand', () => {

const getSpy = jest.spyOn(LocationsEndpoint.prototype, 'get').mockImplementation()

await expect(LocationsCommand.run()).resolves.not.toThrow()
await expect(LocationsCommand.run([])).resolves.not.toThrow()

expect(mockListing).toBeCalledWith(
expect.any(LocationsCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('LocationsCreateCommand', () => {

const createSpy = jest.spyOn(LocationsEndpoint.prototype, 'create').mockImplementation()

await expect(LocationsCreateCommand.run()).resolves.not.toThrow()
await expect(LocationsCreateCommand.run([])).resolves.not.toThrow()

expect(mockInputOutput).toBeCalledWith(
expect.any(LocationsCreateCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('LocationsDeleteCommand', () => {
})

it('prompts user to choose location', async () => {
await expect(LocationsDeleteCommand.run()).resolves.not.toThrow()
await expect(LocationsDeleteCommand.run([])).resolves.not.toThrow()

expect(chooseLocation).toBeCalledWith(expect.any(LocationsDeleteCommand), undefined)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/locations/rooms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('RoomsCommand', () => {
})

it('calls outputListing correctly', async () => {
await expect(RoomsCommand.run()).resolves.not.toThrow()
await expect(RoomsCommand.run([])).resolves.not.toThrow()

expect(mockListing).toBeCalledWith(
expect.any(RoomsCommand),
Expand All @@ -64,7 +64,7 @@ describe('RoomsCommand', () => {
]
mockGetRoomsByLocation.mockResolvedValueOnce(roomList)

await expect(RoomsCommand.run()).resolves.not.toThrow()
await expect(RoomsCommand.run([])).resolves.not.toThrow()

expect(mockGetRoomsByLocation).toBeCalled()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('RoomsCreateCommand', () => {
const room: Room = { name: 'test' }
const createSpy = jest.spyOn(RoomsEndpoint.prototype, 'create').mockResolvedValueOnce(room)

await expect(RoomsCreateCommand.run()).resolves.not.toThrow()
await expect(RoomsCreateCommand.run([])).resolves.not.toThrow()

expect(mockChooseLocation).toBeCalledWith(expect.any(RoomsCreateCommand), undefined)
expect(mockInputOutput).toBeCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('RoomsDeleteCommand', () => {
it('prompts user to choose room', async () => {
mockChooseRoom.mockResolvedValueOnce([uuid(), uuid()])

await expect(RoomsDeleteCommand.run()).resolves.not.toThrow()
await expect(RoomsDeleteCommand.run([])).resolves.not.toThrow()

expect(chooseRoom).toBeCalledWith(expect.any(RoomsDeleteCommand), undefined, undefined)
})
Expand All @@ -40,7 +40,7 @@ describe('RoomsDeleteCommand', () => {
const locationId = uuid()
mockChooseRoom.mockResolvedValueOnce([roomId, locationId])

await expect(RoomsDeleteCommand.run()).resolves.not.toThrow()
await expect(RoomsDeleteCommand.run([])).resolves.not.toThrow()

expect(chooseRoom).toBeCalledWith(expect.any(RoomsDeleteCommand), undefined, undefined)
expect(deleteSpy).toBeCalledWith(roomId, locationId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('RoomsUpdateCommand', () => {
it('prompts user to choose room', async () => {
mockChooseRoom.mockResolvedValueOnce([uuid(), uuid()])

await expect(RoomsUpdateCommand.run()).resolves.not.toThrow()
await expect(RoomsUpdateCommand.run([])).resolves.not.toThrow()

expect(mockChooseRoom).toBeCalledWith(expect.any(RoomsUpdateCommand), undefined, undefined)
})
Expand All @@ -59,7 +59,7 @@ describe('RoomsUpdateCommand', () => {

const updateSpy = jest.spyOn(RoomsEndpoint.prototype, 'update').mockImplementation()

await expect(RoomsUpdateCommand.run()).resolves.not.toThrow()
await expect(RoomsUpdateCommand.run([])).resolves.not.toThrow()

expect(mockChooseRoom).toBeCalledWith(expect.any(RoomsUpdateCommand), undefined, undefined)
expect(mockInputOutput).toBeCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('LocationsUpdateCommand', () => {
})

it('prompts user to choose location', async () => {
await expect(LocationsUpdateCommand.run()).resolves.not.toThrow()
await expect(LocationsUpdateCommand.run([])).resolves.not.toThrow()

expect(chooseLocation).toBeCalledWith(expect.any(LocationsUpdateCommand), undefined)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/organizations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('OrganizationsCommand', () => {
})

it('calls outputListing when no id is provided', async () => {
await expect(OrganizationsCommand.run()).resolves.not.toThrow()
await expect(OrganizationsCommand.run([])).resolves.not.toThrow()

expect(mockListing).toBeCalledTimes(1)
expect(mockListing.mock.calls[0][2]).toBeUndefined()
Expand All @@ -46,7 +46,7 @@ describe('OrganizationsCommand', () => {

const getSpy = jest.spyOn(OrganizationsEndpoint.prototype, 'get').mockImplementation()

await expect(OrganizationsCommand.run()).resolves.not.toThrow()
await expect(OrganizationsCommand.run([])).resolves.not.toThrow()

expect(mockListing).toBeCalledWith(
expect.any(OrganizationsCommand),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('DeviceConfigPresentationCommand', () => {
})

it('throws error when required arg missing', async () => {
await expect(DeviceConfigPresentationCommand.run()).rejects.toThrow()
await expect(DeviceConfigPresentationCommand.run([])).rejects.toThrow()
})

it('outputs item when required arg is provided', async () => {
Expand Down

0 comments on commit 233625f

Please sign in to comment.