Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasBaqqari-CabinetOffice committed Apr 16, 2024
1 parent eff2dc6 commit 60ef100
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions __tests__/components/grant-details/grant-details-header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ const grant = {
const component = <GrantDetailsHeader grant={grant} />;

describe('GrantDetailsHeader component', () => {
it('should render a header with all the correct attributes set by the component', () => {
beforeEach(() => {
render(component);
});

it('should render a header with all the correct attributes set by the component', () => {
const header = screen.getByRole('heading', { name: 'test' });
expect(header).toBeDefined();
expect(header.getAttribute('tabindex')).toBe('-1');
});

it('should render an opening and closing date on the screen', () => {
render(component);
expect(screen.getByText('7 April 2022, 9:34am')).toBeDefined();
expect(screen.getByText('15 April 2022, 9:34am')).toBeDefined();
});

it('should render an altered opening and closing date on the screen for midnight times', () => {
render(component);
const grantWithMidnightDates = {
...grant,
grantApplicationOpenDate: '2022-04-07T00:00:00.000+00',
Expand All @@ -45,7 +46,6 @@ describe('GrantDetailsHeader component', () => {
});

it('should render an altered opening and closing date on the screen for midday times', () => {
render(component);
const grantWithMidnightDates = {
...grant,
grantApplicationOpenDate: '2022-04-07T12:00:00.000+00',
Expand All @@ -65,13 +65,11 @@ describe('GrantDetailsHeader component', () => {
});

it('should render the values from glossary.json for the opening and closing dates', () => {
render(component);
expect(screen.getByText('Closing date:')).toBeDefined();
expect(screen.getByText('Opening date:')).toBeDefined();
});

it('should Render the shortDescription', () => {
render(component);
screen.getByText('Short Description');
});
});

0 comments on commit 60ef100

Please sign in to comment.