-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate
editors-non-ideal-state
test to RTL (#1627)
- Loading branch information
Showing
5 changed files
with
42 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
|
||
import { render } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
import { RenderNonIdealState } from '../../src/renderer/components/editors-non-ideal-state'; | ||
import { EditorMosaic } from '../../src/renderer/editor-mosaic'; | ||
|
||
describe('RenderNonIdealState component', () => { | ||
let editorMosaic: EditorMosaic; | ||
|
||
beforeEach(() => { | ||
({ editorMosaic } = window.app.state); | ||
}); | ||
|
||
it('renders a non-ideal state', () => { | ||
const { getByText } = render( | ||
<RenderNonIdealState editorMosaic={{} as EditorMosaic} />, | ||
); | ||
|
||
expect(getByText('Reset editors')).toBeInTheDocument(); | ||
}); | ||
|
||
it('handles a click', async () => { | ||
const resetLayoutSpy = jest.spyOn(editorMosaic, 'resetLayout'); | ||
const { getByRole } = render( | ||
<RenderNonIdealState editorMosaic={editorMosaic} />, | ||
); | ||
await userEvent.click(getByRole('button')); | ||
|
||
expect(resetLayoutSpy).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
This file contains 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
This file contains 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
14 changes: 0 additions & 14 deletions
14
tests/renderer/components/__snapshots__/editors-non-ideal-state-spec.tsx.snap
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
tests/renderer/components/editors-non-ideal-state-spec.tsx
This file was deleted.
Oops, something went wrong.