|
@@ -1,8 +1,10 @@
|
|
|
-import {cleanup, render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
+import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
-import LoadingContainer from 'sentry/components/loading/loadingContainer';
|
|
|
+import LoadingContainer, {
|
|
|
+ LoadingContainerProps,
|
|
|
+} from 'sentry/components/loading/loadingContainer';
|
|
|
|
|
|
-function renderComponent(props) {
|
|
|
+function renderComponent(props: LoadingContainerProps = {}) {
|
|
|
return render(
|
|
|
<LoadingContainer {...props}>
|
|
|
<div>hello!</div>
|
|
@@ -11,18 +13,14 @@ function renderComponent(props) {
|
|
|
}
|
|
|
|
|
|
describe('LoadingContainer', () => {
|
|
|
- afterEach(cleanup);
|
|
|
-
|
|
|
- it('handles normal state', () => {
|
|
|
+ it('handles normal state', function () {
|
|
|
renderComponent();
|
|
|
expect(screen.getByText('hello!')).toBeInTheDocument();
|
|
|
expect(() => screen.getByTestId('loading-indicator')).toThrow();
|
|
|
});
|
|
|
|
|
|
- it('handles loading state', () => {
|
|
|
- const {rerender} = renderComponent({
|
|
|
- isLoading: true,
|
|
|
- });
|
|
|
+ it('handles loading state', function () {
|
|
|
+ const {rerender} = renderComponent({isLoading: true});
|
|
|
expect(screen.getByText('hello!')).toBeInTheDocument();
|
|
|
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
|
|
|
rerender(<LoadingContainer isLoading />);
|
|
@@ -30,10 +28,8 @@ describe('LoadingContainer', () => {
|
|
|
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
- it('handles reloading state', () => {
|
|
|
- const {rerender} = renderComponent({
|
|
|
- isReloading: true,
|
|
|
- });
|
|
|
+ it('handles reloading state', function () {
|
|
|
+ const {rerender} = renderComponent({isReloading: true});
|
|
|
expect(screen.getByText('hello!')).toBeInTheDocument();
|
|
|
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
|
|
|
rerender(<LoadingContainer isReloading />);
|