diff --git a/app/javascript/article-form/components/__tests__/Title.test.jsx b/app/javascript/article-form/components/__tests__/Title.test.jsx index 59f1807a4..55615e091 100644 --- a/app/javascript/article-form/components/__tests__/Title.test.jsx +++ b/app/javascript/article-form/components/__tests__/Title.test.jsx @@ -28,6 +28,6 @@ describe('', () => { expect( queryByPlaceholderText(/post title/i, { selector: 'textarea' }), - ).toBeDefined(); + ).toExist(); }); }); diff --git a/app/javascript/articles/__tests__/Article.test.jsx b/app/javascript/articles/__tests__/Article.test.jsx index bfe18e12c..d083e306e 100644 --- a/app/javascript/articles/__tests__/Article.test.jsx +++ b/app/javascript/articles/__tests__/Article.test.jsx @@ -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)', () => { diff --git a/app/javascript/articles/__tests__/ArticleLoading.test.jsx b/app/javascript/articles/__tests__/ArticleLoading.test.jsx index 5cfeab954..eac130705 100644 --- a/app/javascript/articles/__tests__/ArticleLoading.test.jsx +++ b/app/javascript/articles/__tests__/ArticleLoading.test.jsx @@ -14,6 +14,6 @@ describe('<LoadingArticle />', () => { it('should render', () => { const { queryByTitle } = render(<LoadingArticle />); - expect(queryByTitle('Loading posts...')).toBeDefined(); + expect(queryByTitle('Loading posts...')).toExist(); }); }); diff --git a/app/javascript/articles/components/__tests__/CommentsList.test.jsx b/app/javascript/articles/components/__tests__/CommentsList.test.jsx index ccafb7c2d..4c8031f6a 100644 --- a/app/javascript/articles/components/__tests__/CommentsList.test.jsx +++ b/app/javascript/articles/components/__tests__/CommentsList.test.jsx @@ -76,6 +76,6 @@ describe('<CommentsList />', () => { />, ); - expect(queryByTestId('see-all-comments')).toBeDefined(); + expect(queryByTestId('see-all-comments')).toExist(); }); }); diff --git a/app/javascript/githubRepos/__tests__/githubRepos.test.jsx b/app/javascript/githubRepos/__tests__/githubRepos.test.jsx index b7e823a1d..cac5fd790 100644 --- a/app/javascript/githubRepos/__tests__/githubRepos.test.jsx +++ b/app/javascript/githubRepos/__tests__/githubRepos.test.jsx @@ -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 () => { diff --git a/app/javascript/leftSidebar/__tests__/TagsFollowed.test.jsx b/app/javascript/leftSidebar/__tests__/TagsFollowed.test.jsx index 64a342f0d..8b207209a 100644 --- a/app/javascript/leftSidebar/__tests__/TagsFollowed.test.jsx +++ b/app/javascript/leftSidebar/__tests__/TagsFollowed.test.jsx @@ -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(); }); }); diff --git a/app/javascript/listings/__tests__/ListingFilterTags.test.jsx b/app/javascript/listings/__tests__/ListingFilterTags.test.jsx index e6d245d4b..bfbd9b3e8 100644 --- a/app/javascript/listings/__tests__/ListingFilterTags.test.jsx +++ b/app/javascript/listings/__tests__/ListingFilterTags.test.jsx @@ -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(); }); }); }); diff --git a/app/javascript/listings/__tests__/ListingFiltersCategories.test.jsx b/app/javascript/listings/__tests__/ListingFiltersCategories.test.jsx index 6f51c22ce..37bdbb440 100644 --- a/app/javascript/listings/__tests__/ListingFiltersCategories.test.jsx +++ b/app/javascript/listings/__tests__/ListingFiltersCategories.test.jsx @@ -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(); }); }); diff --git a/app/javascript/listings/__tests__/ModalBackground.test.jsx b/app/javascript/listings/__tests__/ModalBackground.test.jsx index d3ed15d1e..2a3ab6c09 100644 --- a/app/javascript/listings/__tests__/ModalBackground.test.jsx +++ b/app/javascript/listings/__tests__/ModalBackground.test.jsx @@ -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', () => { diff --git a/app/javascript/listings/__tests__/NextPageButton.test.jsx b/app/javascript/listings/__tests__/NextPageButton.test.jsx index 50c5e5b2d..7fe8c6783 100644 --- a/app/javascript/listings/__tests__/NextPageButton.test.jsx +++ b/app/javascript/listings/__tests__/NextPageButton.test.jsx @@ -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', () => { diff --git a/app/javascript/listings/__tests__/SelectedTags.test.jsx b/app/javascript/listings/__tests__/SelectedTags.test.jsx index 413929058..372843813 100644 --- a/app/javascript/listings/__tests__/SelectedTags.test.jsx +++ b/app/javascript/listings/__tests__/SelectedTags.test.jsx @@ -23,7 +23,7 @@ describe('<SelectedTags />', () => { const { queryByText } = renderSelectedTags(); tags.forEach((tag) => { - expect(queryByText(tag)).toBeDefined(); + expect(queryByText(tag)).toExist(); }); }); diff --git a/app/javascript/listings/__tests__/SingleListing.test.jsx b/app/javascript/listings/__tests__/SingleListing.test.jsx index 5dbbeb79f..4423aa78c 100644 --- a/app/javascript/listings/__tests__/SingleListing.test.jsx +++ b/app/javascript/listings/__tests__/SingleListing.test.jsx @@ -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', () => { diff --git a/app/javascript/onboarding/__tests__/Onboarding.test.jsx b/app/javascript/onboarding/__tests__/Onboarding.test.jsx index f36cb4067..98243f896 100644 --- a/app/javascript/onboarding/__tests__/Onboarding.test.jsx +++ b/app/javascript/onboarding/__tests__/Onboarding.test.jsx @@ -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 () => { diff --git a/app/javascript/onboarding/components/__tests__/EmailPreferencesForm.test.jsx b/app/javascript/onboarding/components/__tests__/EmailPreferencesForm.test.jsx index 3d8918557..e9a486d66 100644 --- a/app/javascript/onboarding/components/__tests__/EmailPreferencesForm.test.jsx +++ b/app/javascript/onboarding/components/__tests__/EmailPreferencesForm.test.jsx @@ -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(); }); }); diff --git a/app/javascript/onboarding/components/__tests__/FollowTags.test.jsx b/app/javascript/onboarding/components/__tests__/FollowTags.test.jsx index 6e9fde898..776423784 100644 --- a/app/javascript/onboarding/components/__tests__/FollowTags.test.jsx +++ b/app/javascript/onboarding/components/__tests__/FollowTags.test.jsx @@ -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 () => { diff --git a/app/javascript/onboarding/components/__tests__/ProfileForm.test.jsx b/app/javascript/onboarding/components/__tests__/ProfileForm.test.jsx index 61b4423cb..6a3159af6 100644 --- a/app/javascript/onboarding/components/__tests__/ProfileForm.test.jsx +++ b/app/javascript/onboarding/components/__tests__/ProfileForm.test.jsx @@ -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 () => { diff --git a/app/javascript/organization/__tests__/OrganizationPicker.test.jsx b/app/javascript/organization/__tests__/OrganizationPicker.test.jsx index bc29ec7ca..24cfa95c9 100644 --- a/app/javascript/organization/__tests__/OrganizationPicker.test.jsx +++ b/app/javascript/organization/__tests__/OrganizationPicker.test.jsx @@ -66,6 +66,6 @@ describe('<OrganizationPicker />', () => { />, ); - expect(queryByText('None')).toBeDefined(); + expect(queryByText('None')).toExist(); }); }); diff --git a/app/javascript/readingList/components/__tests__/ItemListItem.test.jsx b/app/javascript/readingList/components/__tests__/ItemListItem.test.jsx index a3bce6ac6..701ca7d4d 100644 --- a/app/javascript/readingList/components/__tests__/ItemListItem.test.jsx +++ b/app/javascript/readingList/components/__tests__/ItemListItem.test.jsx @@ -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.', () => { diff --git a/app/javascript/readingList/components/__tests__/ItemListItemArchiveButton.test.jsx b/app/javascript/readingList/components/__tests__/ItemListItemArchiveButton.test.jsx index 37a1b4d95..3c2528bd8 100644 --- a/app/javascript/readingList/components/__tests__/ItemListItemArchiveButton.test.jsx +++ b/app/javascript/readingList/components/__tests__/ItemListItemArchiveButton.test.jsx @@ -16,6 +16,6 @@ describe('<ItemListItemArchiveButton />', () => { <ItemListItemArchiveButton text="archive" />, ); - expect(queryByText(/archive/i)).toBeDefined(); + expect(queryByText(/archive/i)).toExist(); }); }); diff --git a/app/javascript/sidebar-widget/__tests__/sidebarUser.test.jsx b/app/javascript/sidebar-widget/__tests__/sidebarUser.test.jsx index fd924bc2f..a48e887f2 100644 --- a/app/javascript/sidebar-widget/__tests__/sidebarUser.test.jsx +++ b/app/javascript/sidebar-widget/__tests__/sidebarUser.test.jsx @@ -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(); }); }); });