Skip to content

Commit

Permalink
Merge branch 'MAIN-B-21507_POD-POE_TOO_Validation' into INT-B-21507_P…
Browse files Browse the repository at this point in the history
…OD-POE_TOO_Validation
  • Loading branch information
msaki-caci committed Jan 10, 2025
2 parents a5ebb42 + 950e587 commit 6118230
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
46 changes: 46 additions & 0 deletions src/components/Office/PortTable/PortTable.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';

import PortTable from './PortTable';

const poeLocationSet = {
poeLocation: {
portCode: 'PDX',
portName: 'PORTLAND INTL',
city: 'PORTLAND',
state: 'OREGON',
zip: '97220',
},
podLocation: null,
};

const podLocationSet = {
poeLocation: null,
podLocation: {
portCode: 'SEA',
portName: 'SEATTLE TACOMA INTL',
city: 'SEATTLE',
state: 'WASHINGTON',
zip: '98158',
},
};

export default {
title: 'Office Components / PortTable',
component: PortTable,
};

export const standard = () => {
return (
<div className="officeApp">
<PortTable {...poeLocationSet} />
</div>
);
};

export const podLocationDisplay = () => {
return (
<div className="officeApp">
<PortTable {...podLocationSet} />
</div>
);
};
8 changes: 4 additions & 4 deletions src/components/Office/PortTable/PortTable.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';

import PortTable from './PortTable';

const poeLocation = {
const poeLocationSet = {
poeLocation: {
portCode: 'PDX',
portName: 'PORTLAND INTL',
Expand All @@ -14,7 +14,7 @@ const poeLocation = {
podLocation: null,
};

const podLocation = {
const podLocationSet = {
poeLocation: null,
podLocation: {
portCode: 'SEA',
Expand All @@ -32,15 +32,15 @@ const nullPortLocation = {

describe('PortTable', () => {
it('renders POE location if poeLocation is set', async () => {
render(<PortTable {...poeLocation} />);
render(<PortTable {...poeLocationSet} />);
expect(screen.getByText(/PDX - PORTLAND INTL/)).toBeInTheDocument();
expect(screen.getByText(/Portland, Oregon 97220/)).toBeInTheDocument();
expect(screen.queryByText(/SEA - SEATTLE TACOMA INTL/)).not.toBeInTheDocument();
expect(screen.queryByText(/Seattle, Washington 98158/)).not.toBeInTheDocument();
});

it('renders POD location if podLocation is set', async () => {
render(<PortTable {...podLocation} />);
render(<PortTable {...podLocationSet} />);
expect(screen.queryByText(/PDX - PORTLAND INTL/)).not.toBeInTheDocument();
expect(screen.queryByText(/Portland, Oregon 97220/)).not.toBeInTheDocument();
expect(screen.getByText(/SEA - SEATTLE TACOMA INTL/)).toBeInTheDocument();
Expand Down

0 comments on commit 6118230

Please sign in to comment.