sforkowany z mirror/soapbox
Fix types in various component tests
rodzic
354395501e
commit
bdf00bb692
|
@ -15,12 +15,12 @@ const TestableComponent = () => (
|
|||
<Route path='/login' exact><span data-testid='sign-in'>Sign in</span></Route>
|
||||
|
||||
{/* WrappedRount will redirect to /login for logged out users... which will resolve to the route above! */}
|
||||
<WrappedRoute path='/notifications' />
|
||||
<WrappedRoute path='/notifications' component={() => null} />
|
||||
</Switch>
|
||||
);
|
||||
|
||||
describe('<UI />', () => {
|
||||
let store;
|
||||
let store: any;
|
||||
|
||||
beforeEach(() => {
|
||||
store = {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { Provider } from 'react-redux';
|
||||
|
@ -11,7 +10,7 @@ import rootReducer from 'soapbox/reducers';
|
|||
|
||||
import ComposeButton from '../compose-button';
|
||||
|
||||
const store = mockStore(rootReducer(ImmutableMap(), {}));
|
||||
const store = mockStore(rootReducer(undefined, {} as any));
|
||||
const renderComposeButton = () => {
|
||||
render(
|
||||
<Provider store={store}>
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('<CtaBanner />', () => {
|
|||
it('renders empty', () => {
|
||||
const store = { me: true };
|
||||
|
||||
render(<CtaBanner />, null, store);
|
||||
render(<CtaBanner />, undefined, store);
|
||||
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ describe('<CtaBanner />', () => {
|
|||
it('renders empty', () => {
|
||||
const store = { soapbox: ImmutableMap({ singleUserMode: true }) };
|
||||
|
||||
render(<CtaBanner />, null, store);
|
||||
render(<CtaBanner />, undefined, store);
|
||||
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,7 +5,9 @@ import { render, screen } from '../../../../jest/test-helpers';
|
|||
import { normalizeAccount, normalizeRelationship } from '../../../../normalizers';
|
||||
import SubscribeButton from '../subscription-button';
|
||||
|
||||
let account = {
|
||||
import type { ReducerAccount } from 'soapbox/reducers/accounts';
|
||||
|
||||
const justin = {
|
||||
id: '1',
|
||||
acct: 'justin-username',
|
||||
display_name: 'Justin L',
|
||||
|
@ -13,13 +15,13 @@ let account = {
|
|||
};
|
||||
|
||||
describe('<SubscribeButton />', () => {
|
||||
let store;
|
||||
let store: any;
|
||||
|
||||
describe('with "accountNotifies" disabled', () => {
|
||||
it('renders nothing', () => {
|
||||
account = normalizeAccount({ ...account, relationship: normalizeRelationship({ following: true }) });
|
||||
const account = normalizeAccount({ ...justin, relationship: normalizeRelationship({ following: true }) }) as ReducerAccount;
|
||||
|
||||
render(<SubscribeButton account={account} />, null, store);
|
||||
render(<SubscribeButton account={account} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('icon-button')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('<TrendsPanel />', () => {
|
|||
})(),
|
||||
};
|
||||
|
||||
render(<TrendsPanel limit={1} />, null, store);
|
||||
render(<TrendsPanel limit={1} />, undefined, store);
|
||||
expect(screen.getByTestId('hashtag')).toHaveTextContent(/hashtag 1/i);
|
||||
expect(screen.getByTestId('hashtag')).toHaveTextContent(/180 people talking/i);
|
||||
expect(screen.getByTestId('sparklines')).toBeInTheDocument();
|
||||
|
@ -46,7 +46,7 @@ describe('<TrendsPanel />', () => {
|
|||
})(),
|
||||
};
|
||||
|
||||
render(<TrendsPanel limit={3} />, null, store);
|
||||
render(<TrendsPanel limit={3} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('hashtag')).toHaveLength(2);
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ describe('<TrendsPanel />', () => {
|
|||
})(),
|
||||
};
|
||||
|
||||
render(<TrendsPanel limit={1} />, null, store);
|
||||
render(<TrendsPanel limit={1} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('hashtag')).toHaveLength(1);
|
||||
});
|
||||
|
||||
|
@ -79,7 +79,7 @@ describe('<TrendsPanel />', () => {
|
|||
})(),
|
||||
};
|
||||
|
||||
render(<TrendsPanel limit={1} />, null, store);
|
||||
render(<TrendsPanel limit={1} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('hashtag')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('<WhoToFollow />', () => {
|
|||
},
|
||||
};
|
||||
|
||||
render(<WhoToFollowPanel limit={1} />, null, store);
|
||||
render(<WhoToFollowPanel limit={1} />, undefined, store);
|
||||
expect(screen.getByTestId('account')).toHaveTextContent(/my name/i);
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@ describe('<WhoToFollow />', () => {
|
|||
},
|
||||
};
|
||||
|
||||
render(<WhoToFollowPanel limit={3} />, null, store);
|
||||
render(<WhoToFollowPanel limit={3} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('account')).toHaveLength(2);
|
||||
});
|
||||
|
||||
|
@ -92,7 +92,7 @@ describe('<WhoToFollow />', () => {
|
|||
},
|
||||
};
|
||||
|
||||
render(<WhoToFollowPanel limit={1} />, null, store);
|
||||
render(<WhoToFollowPanel limit={1} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('account')).toHaveLength(1);
|
||||
});
|
||||
|
||||
|
@ -117,7 +117,7 @@ describe('<WhoToFollow />', () => {
|
|||
},
|
||||
};
|
||||
|
||||
render(<WhoToFollowPanel limit={1} />, null, store);
|
||||
render(<WhoToFollowPanel limit={1} />, undefined, store);
|
||||
expect(screen.queryAllByTestId('account')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ import { normalizeAccount, normalizeStatus } from '../../../../../../normalizers
|
|||
import ReportModal from '../report-modal';
|
||||
|
||||
describe('<ReportModal />', () => {
|
||||
let store;
|
||||
let store: any;
|
||||
|
||||
beforeEach(() => {
|
||||
const rules = require('soapbox/__fixtures__/rules.json');
|
||||
|
|
Ładowanie…
Reference in New Issue