Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-h1 committed Jan 5, 2025
1 parent b2859aa commit 20d5efc
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions src/components/ExperienceItem/ExperienceItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const skyBet = companies.find(
company => company.title === 'Sky Betting & Gaming',
) as Company;

const flutter = companies.find(
company => company.title === 'Flutter UKI',
) as Company;

describe('ExperienceItem', () => {
test.each(companies)('should render title for %s', company => {
const { container } = render(<ExperienceItem company={company} />);
Expand All @@ -21,7 +25,7 @@ describe('ExperienceItem', () => {
test('renders all jobs', () => {
render(<ExperienceItem company={hive} />);

const list = screen.getByTestId(`ExperienceItem-list-HiveIT`);
const list = screen.getByTestId('ExperienceItem-list-HiveIT');
const items = within(list).getAllByRole('listitem');

expect(items).toHaveLength(3);
Expand All @@ -30,7 +34,7 @@ describe('ExperienceItem', () => {
test('renders in desc order', () => {
render(<ExperienceItem company={hive} />);

const list = screen.getByTestId(`ExperienceItem-list-HiveIT`);
const list = screen.getByTestId('ExperienceItem-list-HiveIT');
const items = within(list).getAllByRole('listitem');

expect(items[0]).toHaveTextContent('Software Engineer');
Expand All @@ -41,7 +45,7 @@ describe('ExperienceItem', () => {
test('renders correct dates', () => {
render(<ExperienceItem company={hive} />);

const list = screen.getByTestId(`ExperienceItem-list-HiveIT`);
const list = screen.getByTestId('ExperienceItem-list-HiveIT');
const items = within(list).getAllByRole('listitem');

expect(items[0]).toHaveTextContent('May 2022 — Aug 2023');
Expand Down Expand Up @@ -70,25 +74,25 @@ describe('ExperienceItem', () => {

expect(
screen.getByTestId(`HiveIT-${toCamelCase(job.title)}-description`),
).toHaveTextContent(job.description);
).toHaveTextContent(job.description as string);
});
});

describe('SkyBet', () => {
test('renders all jobs', () => {
render(<ExperienceItem company={skyBet} />);

const list = screen.getByTestId(`ExperienceItem-list-SkyBetting&Gaming`);
const list = screen.getByTestId('ExperienceItem-list-SkyBetting&Gaming');
const items = within(list).getAllByRole('listitem');
expect(items).toHaveLength(1);

expect(items[0]).toHaveTextContent('Software Engineer');
});

test('renders correct dates', () => {
test('renders correct date range', () => {
render(<ExperienceItem company={skyBet} />);

const list = screen.getByTestId(`ExperienceItem-list-SkyBetting&Gaming`);
const list = screen.getByTestId('ExperienceItem-list-SkyBetting&Gaming');
const items = within(list).getAllByRole('listitem');

expect(items[0]).toHaveTextContent('Aug 2023 — Nov 2024');
Expand All @@ -107,7 +111,35 @@ describe('ExperienceItem', () => {

expect(
screen.getByTestId('SkyBetting&Gaming-SoftwareEngineer-description'),
).toHaveTextContent(skyBet.jobs[0].description);
).toHaveTextContent(skyBet.jobs[0].description as string);
});
});

describe('Flutter', () => {
test('renders all jobs', () => {
render(<ExperienceItem company={flutter} />);
const list = screen.getByTestId('ExperienceItem-list-FlutterUKI');
const items = within(list).getAllByRole('listitem');
expect(items).toHaveLength(1);

expect(items[0]).toHaveTextContent('Software Developer');
});

test('renders correct date range', () => {
render(<ExperienceItem company={flutter} />);

const list = screen.getByTestId('ExperienceItem-list-FlutterUKI');
const items = within(list).getAllByRole('listitem');

expect(items[0]).toHaveTextContent('Jan 2025 — Now');
});

test('renders description', () => {
render(<ExperienceItem company={flutter} />);

expect(
screen.getByTestId('FlutterUKI-SoftwareDeveloper-description'),
).toHaveTextContent('No description yet');
});
});
});

0 comments on commit 20d5efc

Please sign in to comment.