Skip to content

Commit

Permalink
UICAL-220: Created test for MCLRowFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-hellen committed Jun 6, 2024
1 parent aea8d54 commit 302ad04
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/components/fields/MCLRowFormatter.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { render, screen } from '@testing-library/react'
import React from 'react'
import MCLRowFormatter from './MCLRowFormatter'
import { MCLContentsType } from './ExceptionFieldTypes';
import RowType from './RowType';

describe('MCLRowFormatter', () => {
it('Renders the formatter correctly', async () => {
render(
<MCLRowFormatter<MCLContentsType>
rowClass='test-classname'
rowWidth={1}
rowIndex={1}
labelStrings={['foo']}
cells={[<h1 key='foo'>test</h1>]}
rowData={
{ rowState:
{ i: 1,
name: 'foo',
type: RowType.Open,
lastRowI: 1,
rows: [{
i: 1,
startDate: undefined,
startTime: undefined,
endDate: undefined,
endTime: undefined
}]
},
name: undefined,
status: undefined,
startDate: undefined,
startTime: undefined,
endDate: undefined,
endTime: undefined,
actions: undefined,
isConflicted: false
}
}
rowProps={{} as any}
/>
);

expect(await screen.findByRole('heading')).toBeInTheDocument();
expect((await screen.findByRole('heading')).textContent).toBe('test');
expect((await screen.findByRole('heading')).parentElement?.className).toBe('test-classname');
});

});

0 comments on commit 302ad04

Please sign in to comment.