1
0
mirror of synced 2025-12-19 18:11:23 -05:00
Files
blitz/nextjs/packages/installer/test/executors/print-message-executor.test.tsx
2021-12-10 13:26:54 +01:00

40 lines
1.0 KiB
TypeScript

import { render } from 'ink-testing-library'
import React from 'react'
import stripAnsi from 'strip-ansi'
import { Commit as PrintMessageExecutor } from '../../src/executors/print-message-executor'
describe('Executor', () => {
const executorConfig = {
stepId: 'printMessage',
stepName: 'Print message',
stepType: 'print-message',
explanation: 'Testing text for a print message',
message: 'My message',
}
it('should render PrintMessageExecutor', () => {
const { lastFrame } = render(
<PrintMessageExecutor
cliArgs={null}
cliFlags={{ yesToAll: false }}
onChangeCommitted={() => {}}
step={executorConfig}
/>
)
expect(stripAnsi(lastFrame())).toMatchSnapshot()
})
it('should contain a step name and explanation', () => {
const { frames } = render(
<PrintMessageExecutor
cliArgs={null}
cliFlags={{ yesToAll: false }}
onChangeCommitted={() => {}}
step={executorConfig}
/>
)
expect(frames[0].includes('My message')).toBeTruthy()
})
})