From c3d234f532ed5896e3d3b762bb16af4c21acba2c Mon Sep 17 00:00:00 2001 From: Rob Cameron Date: Tue, 8 Feb 2022 15:39:24 -0800 Subject: [PATCH] Update tests --- web/src/components/Article/Article.stories.js | 2 +- web/src/components/Article/Article.test.js | 8 ++++---- web/src/components/ArticleCell/ArticleCell.test.js | 8 ++++---- web/src/components/ArticlesCell/ArticlesCell.test.js | 12 ++++++------ web/src/layouts/BlogLayout/BlogLayout.test.js | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/web/src/components/Article/Article.stories.js b/web/src/components/Article/Article.stories.js index 8f496c3..27c251f 100644 --- a/web/src/components/Article/Article.stories.js +++ b/web/src/components/Article/Article.stories.js @@ -3,7 +3,7 @@ import Article from './Article' export const generated = () => { return (
{ it('renders a blog post', () => { - const post = { + const article = { id: 1, title: 'First post', body: `Neutra tacos hot chicken prism raw denim, put a bird on it enamel pin post-ironic vape cred DIY. Street art next level umami squid. Hammock hexagon glossier 8-bit banjo. Neutra la croix mixtape echo park four loko semiotics kitsch forage chambray. Semiotics salvia selfies jianbing hella shaman. Letterpress helvetica vaporware cronut, shaman butcher YOLO poke fixie hoodie gentrify woke heirloom.`, createdAt: new Date().toISOString(), } - render(
) + render(
) - expect(screen.getByText(post.title)).toBeInTheDocument() - expect(screen.getByText(post.body)).toBeInTheDocument() + expect(screen.getByText(article.title)).toBeInTheDocument() + expect(screen.getByText(article.body)).toBeInTheDocument() }) }) diff --git a/web/src/components/ArticleCell/ArticleCell.test.js b/web/src/components/ArticleCell/ArticleCell.test.js index a669710..8a6ecb0 100644 --- a/web/src/components/ArticleCell/ArticleCell.test.js +++ b/web/src/components/ArticleCell/ArticleCell.test.js @@ -22,10 +22,10 @@ describe('ArticleCell', () => { }) test('Success renders successfully', async () => { - const post = standard().post - render() + const article = standard().post + render() - expect(screen.getByText(post.title)).toBeInTheDocument() - expect(screen.getByText(post.body)).toBeInTheDocument() + expect(screen.getByText(article.title)).toBeInTheDocument() + expect(screen.getByText(article.body)).toBeInTheDocument() }) }) diff --git a/web/src/components/ArticlesCell/ArticlesCell.test.js b/web/src/components/ArticlesCell/ArticlesCell.test.js index 1545e76..512842a 100644 --- a/web/src/components/ArticlesCell/ArticlesCell.test.js +++ b/web/src/components/ArticlesCell/ArticlesCell.test.js @@ -22,12 +22,12 @@ describe('ArticlesCell', () => { }) test('Success renders successfully', async () => { - const posts = standard().posts - render() + const articles = standard().posts + render() - expect(screen.getByText(posts[0].title)).toBeInTheDocument() - expect(screen.getByText(posts[0].body)).toBeInTheDocument() - expect(screen.getByText(posts[1].title)).toBeInTheDocument() - expect(screen.getByText(posts[1].body)).toBeInTheDocument() + expect(screen.getByText(articles[0].title)).toBeInTheDocument() + expect(screen.getByText(articles[0].body)).toBeInTheDocument() + expect(screen.getByText(articles[1].title)).toBeInTheDocument() + expect(screen.getByText(articles[1].body)).toBeInTheDocument() }) }) diff --git a/web/src/layouts/BlogLayout/BlogLayout.test.js b/web/src/layouts/BlogLayout/BlogLayout.test.js index 5427d35..03aab84 100644 --- a/web/src/layouts/BlogLayout/BlogLayout.test.js +++ b/web/src/layouts/BlogLayout/BlogLayout.test.js @@ -11,18 +11,18 @@ const loggedOut = () => { } describe('BlogLayout', () => { - it('displays a Log In link when not logged in', async () => { + it('displays a Login link when not logged in', async () => { loggedOut() render() - await waitFor(() => expect(screen.getByText('Log In')).toBeInTheDocument()) + await waitFor(() => expect(screen.getByText('Login')).toBeInTheDocument()) }) - it('displays a Log Out link when logged in', async () => { + it('displays a Logout link when logged in', async () => { loggedIn() render() - await waitFor(() => expect(screen.getByText('Log Out')).toBeInTheDocument()) + await waitFor(() => expect(screen.getByText('Logout')).toBeInTheDocument()) }) it("displays a logged in user's email address", async () => {