Created
April 8, 2020 16:51
-
-
Save ctaylo21/42a1d0db4d7bb3d6e2800e14a73cf0cb to your computer and use it in GitHub Desktop.
Example integration test for terminal app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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