-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Porting the accounts info command to TS (#1342)
- Loading branch information
1 parent
91cf915
commit 04942cf
Showing
5 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import yargs, { Argv } from 'yargs'; | ||
import { addConfigOptions } from '../../../lib/commonOpts'; | ||
|
||
jest.mock('yargs'); | ||
jest.mock('../../../lib/commonOpts'); | ||
|
||
// Import this last so mocks apply | ||
import * as accountInfoCommand from '../info'; | ||
|
||
describe('commands/account/info', () => { | ||
const yargsMock = yargs as Argv; | ||
|
||
describe('command', () => { | ||
it('should have the correct command structure', () => { | ||
expect(accountInfoCommand.command).toEqual('info [account]'); | ||
}); | ||
}); | ||
|
||
describe('describe', () => { | ||
it('should provide a description', () => { | ||
expect(accountInfoCommand.describe).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe('builder', () => { | ||
it('should support the correct options', () => { | ||
accountInfoCommand.builder(yargsMock); | ||
|
||
expect(yargsMock.example).toHaveBeenCalledTimes(1); | ||
|
||
expect(addConfigOptions).toHaveBeenCalledTimes(1); | ||
expect(addConfigOptions).toHaveBeenCalledWith(yargsMock); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Options } from 'yargs'; | ||
|
||
export type CommonArgs = { | ||
derivedAccountId: number; | ||
providedAccountId?: number; | ||
d: boolean; | ||
debug: boolean; | ||
}; | ||
|
||
export type ConfigArgs = { | ||
c?: string; | ||
config?: string; | ||
}; | ||
|
||
export type StringArgType = Options & { | ||
type: 'string'; | ||
}; |