From aa0fd6ce80f9a493e97fc003d0d036a95c77bfba Mon Sep 17 00:00:00 2001 From: "Mr. Singleton" Date: Fri, 13 Oct 2023 17:00:16 -0400 Subject: [PATCH] resume feedback and resume portfolio tests --- src/components/BlockContentLayoutContainer.tsx | 4 ++-- .../ResumeFeedbackSection.test.jsx | 17 +++++++++++++++++ .../ResumeFeedbackSection.tsx | 12 ++++++------ .../ResumePortfolioSection.test.jsx | 16 ++++++++++++++++ .../ResumePortfolioSection.tsx | 11 ++++++----- src/stories/data/ResumeFeedbackSectionData.ts | 6 +++--- .../digital-resume/ResumeFeedback.stories.tsx | 12 ++++-------- .../digital-resume/ResumePortfolio.stories.tsx | 4 ++-- 8 files changed, 56 insertions(+), 26 deletions(-) create mode 100644 src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.test.jsx rename src/components/my-digital-resume/{ => resume-feedback-section}/ResumeFeedbackSection.tsx (90%) create mode 100644 src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.test.jsx rename src/components/my-digital-resume/{ => resume-portfolio-section}/ResumePortfolioSection.tsx (95%) diff --git a/src/components/BlockContentLayoutContainer.tsx b/src/components/BlockContentLayoutContainer.tsx index d3d2accb..a51b8bd8 100644 --- a/src/components/BlockContentLayoutContainer.tsx +++ b/src/components/BlockContentLayoutContainer.tsx @@ -40,9 +40,9 @@ import MMHeroContentSection from "./mackenzies-mind/MMHeroContentSection"; import ResumeSkillsSection from "./my-digital-resume/resume-skills-section/ResumeSkillsSection"; import ResumeExperienceSection from "./my-digital-resume/resume-experience-section/ResumeExperienceSection"; import ResumeEducationSection from "./my-digital-resume/resume-education-section/ResumeEducationSection"; -import ResumeFeedbackSection from "./my-digital-resume/ResumeFeedbackSection"; +import ResumeFeedbackSection from "./my-digital-resume/resume-feedback-section/ResumeFeedbackSection"; import ResumeContactUsSection from "./my-digital-resume/ResumeContactUsSection"; -import ResumePortfolioSection from "./my-digital-resume/ResumePortfolioSection"; +import ResumePortfolioSection from "./my-digital-resume/resume-portfolio-section/ResumePortfolioSection"; import WebDevHeroContentSection from "./web-dev-site/WebDevHeroContentSection"; import WebDevStatsCounterSection from "./web-dev-site/WebDevStatsCounterSection"; import WebDevAboutUsSection from "./web-dev-site/WebDevAboutUsSection"; diff --git a/src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.test.jsx b/src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.test.jsx new file mode 100644 index 00000000..f2578d01 --- /dev/null +++ b/src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.test.jsx @@ -0,0 +1,17 @@ +import {render, screen} from '@testing-library/react'; +import expect from "expect"; +import {ResumePortfolioSectionStory} from "../../../stories/digital-resume/ResumePortfolio.stories"; +import {ResumeFeedbackSectionStory} from "../../../stories/digital-resume/ResumeFeedback.stories"; + +describe('Resume Feedback Section', () => { + test('renders all components of feedback section', async () => { + render() + + expect((await screen.findByText('Feedback'))).toBeInTheDocument() + expect((await screen.findByText('.'))).toBeInTheDocument() + expect(await screen.findByText('Take a look at the reviews of my customers and ensure the quality of my services.')).toBeInTheDocument() + expect(await screen.findAllByText('JamWorks')).toHaveLength(2) + expect(await screen.findByText('CEO')).toBeInTheDocument() + expect(await screen.findByText('@')).toBeInTheDocument() + }); +}) diff --git a/src/components/my-digital-resume/ResumeFeedbackSection.tsx b/src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.tsx similarity index 90% rename from src/components/my-digital-resume/ResumeFeedbackSection.tsx rename to src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.tsx index d9a8c887..31ddc433 100644 --- a/src/components/my-digital-resume/ResumeFeedbackSection.tsx +++ b/src/components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection.tsx @@ -1,12 +1,12 @@ import React, {FunctionComponent} from 'react' import {ThemeProvider} from "@mui/material/styles"; import {Grid, Typography} from '@mui/material' -import {ResumeFeedback, ResumeFeedbackSectionType} from "../BlockContentTypes"; -import useThwCommonStyles from "../../common/sanityIo/ThwCommonStyles"; -import {urlFor} from "../block-content-ui/static-pages/cmsStaticPagesClient"; -import {COLORS} from "../../theme/common/ColorPalette"; -import TheWebsiteTheme from "../../theme/Theme"; -import widthUtils from "../../utils/widthUtils"; +import {ResumeFeedback, ResumeFeedbackSectionType} from "../../BlockContentTypes"; +import useThwCommonStyles from "../../../common/sanityIo/ThwCommonStyles"; +import {urlFor} from "../../block-content-ui/static-pages/cmsStaticPagesClient"; +import {COLORS} from "../../../theme/common/ColorPalette"; +import TheWebsiteTheme from "../../../theme/Theme"; +import widthUtils from "../../../utils/widthUtils"; interface IProps { diff --git a/src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.test.jsx b/src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.test.jsx new file mode 100644 index 00000000..d9639c14 --- /dev/null +++ b/src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.test.jsx @@ -0,0 +1,16 @@ +import {render, screen} from '@testing-library/react'; +import expect from "expect"; +import {ResumePortfolioSectionStory} from "../../../stories/digital-resume/ResumePortfolio.stories"; + +describe('Resume Portfolio Section', () => { + test('renders all components of portfolio section', async () => { + render() + + expect((await screen.findByText('Portfolio'))).toBeInTheDocument() + expect((await screen.findByText('.'))).toBeInTheDocument() + expect(await screen.findAllByRole('button')).toHaveLength(8) + expect(await screen.findByText('This is my Portfolio. These projects are in various stages of completion.')).toBeInTheDocument() + expect(await screen.findByText('Fintech Company Website')).toBeInTheDocument() + expect(await screen.findByText('Sep 2019')).toBeInTheDocument() + }); +}) diff --git a/src/components/my-digital-resume/ResumePortfolioSection.tsx b/src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.tsx similarity index 95% rename from src/components/my-digital-resume/ResumePortfolioSection.tsx rename to src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.tsx index f635538e..1d73ecef 100644 --- a/src/components/my-digital-resume/ResumePortfolioSection.tsx +++ b/src/components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection.tsx @@ -1,12 +1,12 @@ import React, {FunctionComponent} from 'react' import {StyledEngineProvider, ThemeProvider} from "@mui/material/styles"; import {Button, ButtonGroup, Chip, Grid, IconButton, Modal, Typography, useTheme} from '@mui/material' -import {ResumePortfolioItem, ResumePortfolioSectionType} from "../BlockContentTypes"; -import TheWebsiteTheme from "../../theme/Theme"; -import useThwCommonStyles from "../../common/sanityIo/ThwCommonStyles"; -import {urlFor} from "../block-content-ui/static-pages/cmsStaticPagesClient"; +import {ResumePortfolioItem, ResumePortfolioSectionType} from "../../BlockContentTypes"; +import TheWebsiteTheme from "../../../theme/Theme"; +import useThwCommonStyles from "../../../common/sanityIo/ThwCommonStyles"; +import {urlFor} from "../../block-content-ui/static-pages/cmsStaticPagesClient"; import {Close} from "@mui/icons-material"; -import dateUtils from "../../utils/dateUtils"; +import dateUtils from "../../../utils/dateUtils"; interface IProps { sectionData: ResumePortfolioSectionType @@ -51,6 +51,7 @@ const ResumePortfolioSection: FunctionComponent = (props: IProps) => { { props.sectionData.portfolioEntries?.map((portfolioItem: ResumePortfolioItem, index2: number) => { return diff --git a/src/stories/data/ResumeFeedbackSectionData.ts b/src/stories/data/ResumeFeedbackSectionData.ts index a8078d29..16fcd5e5 100644 --- a/src/stories/data/ResumeFeedbackSectionData.ts +++ b/src/stories/data/ResumeFeedbackSectionData.ts @@ -18,8 +18,8 @@ const ResumeFeedbackSectionData:ResumeFeedbackSectionType = { // "_updatedAt": "2022-12-01T21:24:38Z", "quote": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable Engl", // "_createdAt": "2022-12-01T20:55:41Z", - "companyName": "JamWorks 24/7", - "name": "JamWorks 24/7", + "companyName": "JamWorks", + "name": "JamWorks", "imageSrc": { "asset": { "_ref": "image-ba4a7c9c01e632950293be433ab1f95560800ce5-728x290-png", @@ -27,7 +27,7 @@ const ResumeFeedbackSectionData:ResumeFeedbackSectionType = { }, "_type": "image" }, - "customerName": "JamWorks 24/7", + "customerName": "JamWorks", "customerTitle": "CEO", // "_rev": "QoSfkmWVFCw5OU4CBmXCaz", "_type": "ResumeFeedback" diff --git a/src/stories/digital-resume/ResumeFeedback.stories.tsx b/src/stories/digital-resume/ResumeFeedback.stories.tsx index ec415c7e..79fbd832 100644 --- a/src/stories/digital-resume/ResumeFeedback.stories.tsx +++ b/src/stories/digital-resume/ResumeFeedback.stories.tsx @@ -1,13 +1,9 @@ import type {Meta, StoryObj} from '@storybook/react'; -import ResumeSkillsSection from "../../components/my-digital-resume/resume-skills-section/ResumeSkillsSection"; -import ResumeSkillSectionData from "../data/ResumeSkillSectionData"; -import ResumeExperienceSection from "../../components/my-digital-resume/resume-experience-section/ResumeExperienceSection"; -import ResumeExperienceSectionData from "../data/ResumeExperienceSectionData"; -import ResumeFeedbackSection from "../../components/my-digital-resume/ResumeFeedbackSection"; +import ResumeFeedbackSection from "../../components/my-digital-resume/resume-feedback-section/ResumeFeedbackSection"; import ResumeFeedbackSectionData from "../data/ResumeFeedbackSectionData"; const meta: Meta = { - title:"Resume/Section/Resume Feedback Section", + title: "Resume/Section/Resume Feedback Section", component: ResumeFeedbackSection, }; @@ -21,8 +17,8 @@ type Story = StoryObj; * to learn how to use render functions. */ -export const Primary: Story = { - args:{ +export const ResumeFeedbackSectionStory: Story = { + args: { sectionData: ResumeFeedbackSectionData }, render: ({sectionData}) => , diff --git a/src/stories/digital-resume/ResumePortfolio.stories.tsx b/src/stories/digital-resume/ResumePortfolio.stories.tsx index 338ce6f4..97ca3415 100644 --- a/src/stories/digital-resume/ResumePortfolio.stories.tsx +++ b/src/stories/digital-resume/ResumePortfolio.stories.tsx @@ -1,6 +1,6 @@ import type {Meta, StoryObj} from '@storybook/react'; import ResumePortfolioSectionData from "../data/ResumePortfolioSectionData"; -import ResumePortfolioSection from '../../components/my-digital-resume/ResumePortfolioSection'; +import ResumePortfolioSection from '../../components/my-digital-resume/resume-portfolio-section/ResumePortfolioSection'; const meta: Meta = { title:"Resume/Section/Resume Portfolio Section", @@ -17,7 +17,7 @@ type Story = StoryObj; * to learn how to use render functions. */ -export const Primary: Story = { +export const ResumePortfolioSectionStory: Story = { args:{ sectionData: ResumePortfolioSectionData },