import { describe, expect, it, vi } from 'vitest'; import { Help } from '../src/react'; import { renderComponent } from '../src/test'; import { commands, options, params } from './__fixtures__/args'; vi.mock('term-size'); describe('', () => { it('renders everything', async () => { await expect( renderComponent( , ), ).resolves.toMatchSnapshot(); }); describe('config', () => { it('renders description', async () => { await expect( renderComponent(), ).resolves.toMatchSnapshot(); }); it('renders description with additional params', async () => { await expect( renderComponent( , ), ).resolves.toMatchSnapshot(); }); it('renders description with markdown', async () => { await expect( renderComponent( , ), ).resolves.toMatchSnapshot(); }); }); describe('usage', () => { it('renders usage string', async () => { await expect( renderComponent(), ).resolves.toMatchSnapshot(); }); it('renders usage array', async () => { await expect( renderComponent( , ), ).resolves.toMatchSnapshot(); }); }); describe('params', () => { it('doesnt render empty params', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders params', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders params (stripped)', async () => { await expect(renderComponent(, true)).resolves.toMatchSnapshot(); }); }); describe('commands', () => { it('doesnt render empty commands', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders commands', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders commands (stripped)', async () => { await expect(renderComponent(, true)).resolves.toMatchSnapshot(); }); }); describe('options', () => { it('doesnt render empty options', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders options', async () => { await expect(renderComponent()).resolves.toMatchSnapshot(); }); it('renders options (stripped)', async () => { await expect(renderComponent(, true)).resolves.toMatchSnapshot(); }); }); });