Skip to content

Commit

Permalink
VirtualHearingFields RTL refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkespoulterva authored and sbashamoni committed Oct 21, 2024
1 parent a45853e commit 8e902a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ describe('VirtualHearingFields', () => {
<VirtualHearingFields
update={updateSpy}
hearing={amaHearing}
virtualHearing={amaHearing.virtualHearing}
/>,
{
wrapper: Wrapper,
Expand Down Expand Up @@ -89,8 +88,6 @@ describe('VirtualHearingFields', () => {
}
);

const hearingMeetingType = amaHearing.judge.meetingType;

// Assertions
const virtualHearingForm = screen.getByRole('heading', { name: /Hearing Links/i });
expect(virtualHearingForm).toBeInTheDocument();
Expand All @@ -104,10 +101,11 @@ describe('VirtualHearingFields', () => {
// Test HearingLinks presence
const guestLink = screen.getByText(/Guest Link:/);
expect(guestLink).toBeInTheDocument();
expect(hearingMeetingType).toBeTruthy();
expect(hearingMeetingType).toStrictEqual('pexip' || 'webex');

expect(virtualHearingForm).toMatchSnapshot();
const links = screen.getAllByRole('button');
expect(links).toHaveLength(1);

expect(asFragment()).toMatchSnapshot();
});

test('Renders webex conference when conference provider is webex', () => {
Expand All @@ -117,7 +115,7 @@ describe('VirtualHearingFields', () => {
};

// Run the test
const virtualHearingForm = mount(
const { asFragment } = customRender(
<VirtualHearingFields
update={updateSpy}
hearing={webexHearing}
Expand All @@ -126,17 +124,15 @@ describe('VirtualHearingFields', () => {
conferenceProvider: 'webex'
}}
/>,

{
wrappingComponent: hearingDetailsWrapper(anyUser, webexHearing),
wrappingComponentProps: { store: detailsStore }
wrapper: Wrapper,
wrapperProps: { user: anyUser, hearing: webexHearing, store: detailsStore }
}
);

// Assertions
expect(virtualHearingForm.text().includes('Webex Hearing')).toBeTruthy();

expect(virtualHearingForm).toMatchSnapshot();
expect(screen.getByText('Webex Hearing')).toBeInTheDocument();
expect(asFragment()).toMatchSnapshot();
});

test('Renders pexip conference when conference provider is pexip', () => {
Expand All @@ -146,7 +142,7 @@ describe('VirtualHearingFields', () => {
};

// Run the test
const virtualHearingForm = mount(
const { asFragment } = customRender(
<VirtualHearingFields
update={updateSpy}
hearing={webexHearing}
Expand All @@ -155,10 +151,9 @@ describe('VirtualHearingFields', () => {
conferenceProvider: 'pexip'
}}
/>,

{
wrappingComponent: hearingDetailsWrapper(anyUser, webexHearing),
wrappingComponentProps: { store: detailsStore }
wrapper: Wrapper,
wrapperProps: { user: anyUser, hearing: webexHearing, store: detailsStore }
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ exports[`VirtualHearingFields Renders pexip conference when conference provider
<div
data-css-1571z6o=""
>
<div
data-css-tx10g=""
>
<strong>
Pexip Hearing
</strong>
</div>
<div
data-css-tx10g=""
>
Expand Down

0 comments on commit 8e902a7

Please sign in to comment.