Skip to content

Commit

Permalink
add account info test scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers committed Jan 21, 2025
1 parent 9a409f6 commit 8792a31
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions commands/account/__tests__/info.test.ts
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);
});
});
});

0 comments on commit 8792a31

Please sign in to comment.