Replace uses of toBeDefined with toExist (#19862)
* Replaced toBeDefined with toExist * Revert db changes
This commit is contained in:
parent
2689da34e7
commit
cce51588db
20 changed files with 58 additions and 59 deletions
|
|
@ -28,6 +28,6 @@ describe('<Title />', () => {
|
|||
|
||||
expect(
|
||||
queryByPlaceholderText(/post title/i, { selector: 'textarea' }),
|
||||
).toBeDefined();
|
||||
).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ describe('<Article /> component', () => {
|
|||
expect(container.firstChild).not.toHaveClass('crayons-story--featured', {
|
||||
exact: false,
|
||||
});
|
||||
expect(queryByAltText('Emil99 profile')).toBeDefined();
|
||||
expect(queryByAltText('Emil99 profile')).toExist();
|
||||
});
|
||||
|
||||
it('should render a featured article', () => {
|
||||
|
|
@ -91,7 +91,7 @@ describe('<Article /> component', () => {
|
|||
expect(container.firstChild).toHaveClass('crayons-story--featured', {
|
||||
exact: false,
|
||||
});
|
||||
expect(queryByAltText('Emil99 profile')).toBeDefined();
|
||||
expect(queryByAltText('Emil99 profile')).toExist();
|
||||
});
|
||||
|
||||
it('should render a rich feed', () => {
|
||||
|
|
@ -122,8 +122,8 @@ describe('<Article /> component', () => {
|
|||
expect(container.firstChild).toHaveClass('crayons-story--featured', {
|
||||
exact: false,
|
||||
});
|
||||
expect(queryByAltText('Web info-mediaries logo')).toBeDefined();
|
||||
expect(queryByAltText('Emil99 profile')).toBeDefined();
|
||||
expect(queryByAltText('Web info-mediaries logo')).toExist();
|
||||
expect(queryByAltText('Emil99 profile')).toExist();
|
||||
});
|
||||
|
||||
it('should render a featured article for a video post', () => {
|
||||
|
|
@ -137,7 +137,7 @@ describe('<Article /> component', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByTitle(/video duration/i)).toBeDefined();
|
||||
expect(queryByTitle(/video duration/i)).toExist();
|
||||
});
|
||||
|
||||
it('should render with an organization', () => {
|
||||
|
|
@ -150,8 +150,8 @@ describe('<Article /> component', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByAltText('Web info-mediaries logo')).toBeDefined();
|
||||
expect(queryByAltText('Emil99 profile')).toBeDefined();
|
||||
expect(queryByAltText('Web info-mediaries logo')).toExist();
|
||||
expect(queryByAltText('Emil99 profile')).toExist();
|
||||
});
|
||||
|
||||
it('should render with a flare tag', () => {
|
||||
|
|
@ -175,7 +175,7 @@ describe('<Article /> component', () => {
|
|||
queryByText(
|
||||
'…copying Rest withdrawal Handcrafted multi-state Pre-emptive e-markets feed...overriding RSS Fantastic Plastic Gloves invoice productize systemic Monaco…',
|
||||
),
|
||||
).toBeDefined();
|
||||
).toExist();
|
||||
});
|
||||
|
||||
it('should render with reactions', () => {
|
||||
|
|
@ -241,7 +241,7 @@ describe('<Article /> component', () => {
|
|||
<Article {...commonProps} isBookmarked={false} article={article} />,
|
||||
);
|
||||
|
||||
expect(queryByTestId('add-a-comment')).toBeDefined();
|
||||
expect(queryByTestId('add-a-comment')).toExist();
|
||||
});
|
||||
|
||||
it('should render as saved on reading list', () => {
|
||||
|
|
@ -270,7 +270,7 @@ describe('<Article /> component', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByTitle(/video duration/i)).toBeDefined();
|
||||
expect(queryByTitle(/video duration/i)).toExist();
|
||||
});
|
||||
|
||||
it('should render a podcast article', () => {
|
||||
|
|
@ -282,8 +282,8 @@ describe('<Article /> component', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByAltText('Rubber local')).toBeDefined();
|
||||
expect(queryByText('podcast', { selector: 'span' })).toBeDefined();
|
||||
expect(queryByAltText('Rubber local')).toExist();
|
||||
expect(queryByText('podcast', { selector: 'span' })).toExist();
|
||||
});
|
||||
|
||||
it('should render a podcast episode', () => {
|
||||
|
|
@ -291,13 +291,13 @@ describe('<Article /> component', () => {
|
|||
<Article isBookmarked={false} article={podcastEpisodeArticle} />,
|
||||
);
|
||||
|
||||
expect(queryByText('podcast', { selector: 'span' })).toBeDefined();
|
||||
expect(queryByText('podcast', { selector: 'span' })).toExist();
|
||||
});
|
||||
|
||||
it('should render a user article', () => {
|
||||
const { queryByText } = render(<Article article={userArticle} />);
|
||||
|
||||
expect(queryByText('person', { selector: 'span' })).toBeDefined();
|
||||
expect(queryByText('person', { selector: 'span' })).toExist();
|
||||
});
|
||||
|
||||
it('should show bookmark button when article is saveable (default)', () => {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ describe('<LoadingArticle />', () => {
|
|||
it('should render', () => {
|
||||
const { queryByTitle } = render(<LoadingArticle />);
|
||||
|
||||
expect(queryByTitle('Loading posts...')).toBeDefined();
|
||||
expect(queryByTitle('Loading posts...')).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,6 +76,6 @@ describe('<CommentsList />', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByTestId('see-all-comments')).toBeDefined();
|
||||
expect(queryByTestId('see-all-comments')).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -228,14 +228,14 @@ describe('<GithubRepos />', () => {
|
|||
|
||||
// No need to test it's contents as this is the <SingleRepo /> component
|
||||
// which has it's own tests.
|
||||
expect(repoList).toBeDefined();
|
||||
expect(repoList).toExist();
|
||||
});
|
||||
|
||||
it('should render with no repositories', () => {
|
||||
fetch.mockResponse('[]');
|
||||
const { queryByTitle } = render(<GithubRepos />);
|
||||
|
||||
expect(queryByTitle('Loading GitHub repositories')).toBeDefined();
|
||||
expect(queryByTitle('Loading GitHub repositories')).toExist();
|
||||
});
|
||||
|
||||
it('should render error message when repositories cannot be loaded', async () => {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ describe('<TagsFollowed />', () => {
|
|||
it('should render the tags followed when tags are passed in', () => {
|
||||
const { queryByTitle } = render(<TagsFollowed tags={getTags()} />);
|
||||
|
||||
expect(queryByTitle('javascript tag')).toBeDefined();
|
||||
expect(queryByTitle('webdev tag')).toBeDefined();
|
||||
expect(queryByTitle('react tag')).toBeDefined();
|
||||
expect(queryByTitle('javascript tag')).toExist();
|
||||
expect(queryByTitle('webdev tag')).toExist();
|
||||
expect(queryByTitle('react tag')).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ describe('<ListingFilterTags />', () => {
|
|||
it('should have "search" as placeholder', () => {
|
||||
const { queryByPlaceholderText } = renderListingFilterTags();
|
||||
|
||||
expect(queryByPlaceholderText(/search/i)).toBeDefined();
|
||||
expect(queryByPlaceholderText(/search/i)).toExist();
|
||||
});
|
||||
|
||||
it(`should have "${getProps().message}" as default value`, () => {
|
||||
const { queryByDisplayValue } = renderListingFilterTags();
|
||||
|
||||
expect(queryByDisplayValue(getProps().message)).toBeDefined();
|
||||
expect(queryByDisplayValue(getProps().message)).toExist();
|
||||
});
|
||||
|
||||
it('should have auto-complete as off', () => {
|
||||
|
|
@ -50,7 +50,7 @@ describe('<ListingFilterTags />', () => {
|
|||
it('should render the clear query button', () => {
|
||||
const { queryByTestId } = renderListingFilterTags();
|
||||
|
||||
expect(queryByTestId('clear-query-button')).toBeDefined();
|
||||
expect(queryByTestId('clear-query-button')).toExist();
|
||||
});
|
||||
|
||||
it('should not render the clear query button', () => {
|
||||
|
|
@ -65,7 +65,7 @@ describe('<ListingFilterTags />', () => {
|
|||
const { queryByText } = renderListingFilterTags();
|
||||
|
||||
getTags().forEach((tag) => {
|
||||
expect(queryByText(`${tag}`)).toBeDefined();
|
||||
expect(queryByText(`${tag}`)).toExist();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,11 +49,10 @@ describe('<ListingFiltersCategories />', () => {
|
|||
|
||||
it('should be "selected" when there is no category selected', () => {
|
||||
const propsWithoutCategory = { ...getProps(), category: '' };
|
||||
const { queryByTestId } = renderListingFilterCategories(
|
||||
propsWithoutCategory,
|
||||
);
|
||||
const { queryByTestId } =
|
||||
renderListingFilterCategories(propsWithoutCategory);
|
||||
|
||||
expect(queryByTestId('selected')).toBeDefined();
|
||||
expect(queryByTestId('selected')).toExist();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ describe('<ModalBackground />', () => {
|
|||
it('should render', () => {
|
||||
const { queryByTestId } = render(<ModalBackground {...defaultProps} />);
|
||||
|
||||
expect(queryByTestId('listings-modal-background')).toBeDefined();
|
||||
expect(queryByTestId('listings-modal-background')).toExist();
|
||||
});
|
||||
|
||||
it('should call the onClick handler', () => {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe('<NextPageButton />', () => {
|
|||
it('should show a button', () => {
|
||||
const { queryByText } = render(<NextPageButton {...defaultProps} />);
|
||||
|
||||
expect(queryByText(/load more/i)).toBeDefined();
|
||||
expect(queryByText(/load more/i)).toExist();
|
||||
});
|
||||
|
||||
it('should call the onclick handler', () => {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe('<SelectedTags />', () => {
|
|||
const { queryByText } = renderSelectedTags();
|
||||
|
||||
tags.forEach((tag) => {
|
||||
expect(queryByText(tag)).toBeDefined();
|
||||
expect(queryByText(tag)).toExist();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ describe('<SingleListing />', () => {
|
|||
|
||||
it('shows a listing title', () => {
|
||||
const { queryByText } = renderSingleListing();
|
||||
expect(queryByText('Illo iure quos perspiciatis.')).toBeDefined();
|
||||
expect(queryByText('Illo iure quos perspiciatis.')).toExist();
|
||||
});
|
||||
|
||||
it('shows a dropdown', () => {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ describe('<Onboarding />', () => {
|
|||
it('should render the IntroSlide first', () => {
|
||||
const { queryByTestId } = renderOnboarding();
|
||||
|
||||
expect(queryByTestId('onboarding-intro-slide')).toBeDefined();
|
||||
expect(queryByTestId('onboarding-intro-slide')).toExist();
|
||||
});
|
||||
|
||||
it('should allow the modal to move forward and backward a step where relevant', async () => {
|
||||
|
|
@ -81,7 +81,7 @@ describe('<Onboarding />', () => {
|
|||
// we should be on the Intro Slide step
|
||||
const introSlide = await findByTestId('onboarding-intro-slide');
|
||||
|
||||
expect(introSlide).toBeDefined();
|
||||
expect(introSlide).toExist();
|
||||
});
|
||||
|
||||
it("should skip the step when 'Skip for now' is clicked", async () => {
|
||||
|
|
@ -105,7 +105,7 @@ describe('<Onboarding />', () => {
|
|||
// we should be on the Follow tags step
|
||||
const followTagsStep = await findByTestId('onboarding-follow-tags');
|
||||
|
||||
expect(followTagsStep).toBeDefined();
|
||||
expect(followTagsStep).toExist();
|
||||
|
||||
// click on skip for now
|
||||
const skipButton = getByText(/Skip for now/i);
|
||||
|
|
@ -114,7 +114,7 @@ describe('<Onboarding />', () => {
|
|||
// we should be on the Profile Form step
|
||||
const profileStep = await findByTestId('onboarding-profile-form');
|
||||
|
||||
expect(profileStep).toBeDefined();
|
||||
expect(profileStep).toExist();
|
||||
});
|
||||
|
||||
it('should redirect the users to the correct steps every time', async () => {
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ describe('EmailPreferencesForm', () => {
|
|||
it('should load the appropriate text', () => {
|
||||
const { queryByText } = renderEmailPreferencesForm();
|
||||
|
||||
expect(queryByText(/almost there!/i)).toBeDefined();
|
||||
expect(queryByText(/almost there!/i)).toExist();
|
||||
expect(
|
||||
queryByText(/review your email preferences before we continue./i),
|
||||
).toBeDefined();
|
||||
expect(queryByText('Email preferences')).toBeDefined();
|
||||
).toExist();
|
||||
expect(queryByText('Email preferences')).toExist();
|
||||
});
|
||||
|
||||
it('should show the two checkboxes unchecked', () => {
|
||||
|
|
@ -66,18 +66,18 @@ describe('EmailPreferencesForm', () => {
|
|||
it('should render a stepper', () => {
|
||||
const { queryByTestId } = renderEmailPreferencesForm();
|
||||
|
||||
expect(queryByTestId('stepper')).toBeDefined();
|
||||
expect(queryByTestId('stepper')).toExist();
|
||||
});
|
||||
|
||||
it('should render a back button', () => {
|
||||
const { queryByTestId } = renderEmailPreferencesForm();
|
||||
|
||||
expect(queryByTestId('back-button')).toBeDefined();
|
||||
expect(queryByTestId('back-button')).toExist();
|
||||
});
|
||||
|
||||
it('should render a button that says Finish', () => {
|
||||
const { queryByText } = renderEmailPreferencesForm();
|
||||
|
||||
expect(queryByText('Finish')).toBeDefined();
|
||||
expect(queryByText('Finish')).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ describe('FollowTags', () => {
|
|||
fetch.mockResponseOnce(fakeTagsResponse);
|
||||
const { getByText } = renderFollowTags();
|
||||
|
||||
expect(getByText(/skip for now/i)).toBeDefined();
|
||||
expect(getByText(/skip for now/i)).toExist();
|
||||
});
|
||||
|
||||
it('should update the status and count when you follow a tag', async () => {
|
||||
|
|
@ -105,13 +105,13 @@ describe('FollowTags', () => {
|
|||
it('should render a stepper', () => {
|
||||
const { queryByTestId } = renderFollowTags();
|
||||
|
||||
expect(queryByTestId('stepper')).toBeDefined();
|
||||
expect(queryByTestId('stepper')).toExist();
|
||||
});
|
||||
|
||||
it('should render a back button', () => {
|
||||
const { queryByTestId } = renderFollowTags();
|
||||
|
||||
expect(queryByTestId('back-button')).toBeDefined();
|
||||
expect(queryByTestId('back-button')).toExist();
|
||||
});
|
||||
|
||||
it('should call handleClick when enter key is pressed', async () => {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ describe('ProfileForm', () => {
|
|||
const { queryByText } = renderProfileForm();
|
||||
|
||||
expect(queryByText('username')).toBeDefined();
|
||||
expect(queryByText('firstname lastname')).toBeDefined();
|
||||
expect(queryByText('firstname lastname')).toExist();
|
||||
});
|
||||
|
||||
it('should show the correct profile picture', () => {
|
||||
|
|
@ -206,13 +206,13 @@ describe('ProfileForm', () => {
|
|||
it('should render a stepper', () => {
|
||||
const { queryByTestId } = renderProfileForm();
|
||||
|
||||
expect(queryByTestId('stepper')).toBeDefined();
|
||||
expect(queryByTestId('stepper')).toExist();
|
||||
});
|
||||
|
||||
it('should show the back button', () => {
|
||||
const { queryByTestId } = renderProfileForm();
|
||||
|
||||
expect(queryByTestId('back-button')).toBeDefined();
|
||||
expect(queryByTestId('back-button')).toExist();
|
||||
});
|
||||
|
||||
it('should not be skippable', async () => {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@ describe('<OrganizationPicker />', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByText('None')).toBeDefined();
|
||||
expect(queryByText('None')).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ describe('<ItemListItem />', () => {
|
|||
it('renders the title', () => {
|
||||
const { queryByText } = render(<ItemListItem item={getItem()} />);
|
||||
|
||||
expect(queryByText(/Title/i)).toBeDefined();
|
||||
expect(queryByText(/Title/i)).toExist();
|
||||
});
|
||||
|
||||
it('renders the path', () => {
|
||||
|
|
@ -45,7 +45,7 @@ describe('<ItemListItem />', () => {
|
|||
it('renders a published date', () => {
|
||||
const { queryByText } = render(<ItemListItem item={getItem()} />);
|
||||
|
||||
expect(queryByText(/Jun 29/i)).toBeDefined();
|
||||
expect(queryByText(/Jun 29/i)).toExist();
|
||||
});
|
||||
|
||||
it('renders a profile_image', () => {
|
||||
|
|
@ -62,7 +62,7 @@ describe('<ItemListItem />', () => {
|
|||
|
||||
const { queryByText } = render(<ItemListItem item={item} />);
|
||||
|
||||
expect(queryByText(/1 min read/i)).toBeDefined();
|
||||
expect(queryByText(/1 min read/i)).toExist();
|
||||
});
|
||||
|
||||
it('renders with readingtime of 1 min if reading time is null.', () => {
|
||||
|
|
@ -71,7 +71,7 @@ describe('<ItemListItem />', () => {
|
|||
|
||||
const { queryByText } = render(<ItemListItem item={item} />);
|
||||
|
||||
expect(queryByText(/1 min read/i)).toBeDefined();
|
||||
expect(queryByText(/1 min read/i)).toExist();
|
||||
});
|
||||
|
||||
it('renders correct readingtime.', () => {
|
||||
|
|
@ -80,7 +80,7 @@ describe('<ItemListItem />', () => {
|
|||
|
||||
const { queryByText } = render(<ItemListItem item={item} />);
|
||||
|
||||
expect(queryByText(/10 min read/i)).toBeDefined();
|
||||
expect(queryByText(/10 min read/i)).toExist();
|
||||
});
|
||||
|
||||
it('renders without any tags if the tags array is empty.', () => {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ describe('<ItemListItemArchiveButton />', () => {
|
|||
<ItemListItemArchiveButton text="archive" />,
|
||||
);
|
||||
|
||||
expect(queryByText(/archive/i)).toBeDefined();
|
||||
expect(queryByText(/archive/i)).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ describe('<SidebarUser />', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByText(/Following/i)).toBeDefined();
|
||||
expect(queryByText(/Following/i)).toExist();
|
||||
});
|
||||
|
||||
it('shows if the user can be followed', () => {
|
||||
|
|
@ -99,7 +99,7 @@ describe('<SidebarUser />', () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
expect(queryByText(/follow/i)).toBeDefined();
|
||||
expect(queryByText(/follow/i)).toExist();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue