import { describe, it, expect } from 'vitest';
import * as React from 'react';
import { Text } from 'ink';
import { OutputStream, render } from '../src/index';
describe('ink-render-string', () => {
it('render API can return rendered output', () => {
const Test = () => Hello World;
const { output, cleanup } = render();
expect(output).toEqual('Hello World');
cleanup();
});
it('returns instance properties', () => {
const Test = () => (
<>
Hello World
Goodbye, cruel world!
>
);
const { output, cleanup, frames, stdout, stderr, unmount } = render(
);
expect(output).toEqual(`Hello World
Goodbye, cruel world!`);
expect(frames).toMatchInlineSnapshot(`
[
"Hello World
Goodbye, cruel world!",
]
`);
expect(unmount).toBeInstanceOf(Function);
expect(stdout).toBeInstanceOf(OutputStream);
expect(stderr).toBeInstanceOf(OutputStream);
cleanup();
});
});