Skip to content

Instantly share code, notes, and snippets.

@ctaylo21
Created April 8, 2020 16:51
Show Gist options
  • Save ctaylo21/42a1d0db4d7bb3d6e2800e14a73cf0cb to your computer and use it in GitHub Desktop.
Save ctaylo21/42a1d0db4d7bb3d6e2800e14a73cf0cb to your computer and use it in GitHub Desktop.
Example integration test for terminal app
test('ls <tab> with no arg should cycle through options', async (): Promise<void> => {
const { getByLabelText } = render(
<Terminal fileSystem={exampleFileSystem} />,
);
const input = getByLabelText('terminal-input') as HTMLInputElement;
await userEvent.type(input, 'ls ');
await fireTabInput(input);
await fireTabInput(input);
expect(input.value).toBe('ls home/');
await fireTabInput(input);
expect(input.value).toBe('ls docs/');
await fireTabInput(input);
expect(input.value).toBe('ls file3.txt');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment