Skip to content

Commit ddbe7fb

Browse files
committed
Add testMetadata to the render of FacultyAdmin in the tests
testMetadata needs to be passed to the render function for Faculty Admin
1 parent 8c61fb4 commit ddbe7fb

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/client/components/pages/__tests__/FacultyAdmin.test.tsx

+17-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
error,
1919
} from 'testData';
2020
import { render } from 'test-utils';
21+
import { testMetadata } from 'common/__tests__/data/metadata';
2122
import FacultyAdmin from '../FacultyAdmin';
2223

2324
describe('Faculty Admin', function () {
@@ -37,22 +38,25 @@ describe('Faculty Admin', function () {
3738
it('creates a table', async function () {
3839
const { container } = render(
3940
<FacultyAdmin />,
40-
dispatchMessage
41+
dispatchMessage,
42+
testMetadata
4143
);
4244
return waitForElement(() => container.querySelector('.faculty-admin-table'));
4345
});
4446
it('creates the "create faculty" button', async function () {
4547
const { container } = render(
4648
<FacultyAdmin />,
47-
dispatchMessage
49+
dispatchMessage,
50+
testMetadata
4851
);
4952
return waitForElement(() => container.querySelector('.create-faculty-button'));
5053
});
5154
context('when course data fetch succeeds', function () {
5255
it('displays the correct faculty information', async function () {
5356
const { getByText } = render(
5457
<FacultyAdmin />,
55-
dispatchMessage
58+
dispatchMessage,
59+
testMetadata
5660
);
5761
strictEqual(getStub.callCount, 1);
5862
const { lastName } = bioengineeringFacultyMemberResponse;
@@ -61,7 +65,8 @@ describe('Faculty Admin', function () {
6165
it('displays the correct number of rows in the table', async function () {
6266
const { getAllByRole } = render(
6367
<FacultyAdmin />,
64-
dispatchMessage
68+
dispatchMessage,
69+
testMetadata
6570
);
6671
await wait(() => getAllByRole('row').length > 1);
6772
const rows = getAllByRole('row');
@@ -70,7 +75,8 @@ describe('Faculty Admin', function () {
7075
it('displays the correct content in the table cells', async function () {
7176
const { getAllByRole } = render(
7277
<FacultyAdmin />,
73-
dispatchMessage
78+
dispatchMessage,
79+
testMetadata
7480
);
7581
await wait(() => getAllByRole('row').length > 1);
7682
const rows = Array.from(getAllByRole('row')) as HTMLTableRowElement[];
@@ -112,7 +118,8 @@ describe('Faculty Admin', function () {
112118
it('does not pass the backgroundColor prop when area does not exist', async function () {
113119
const { getAllByRole, getByText } = render(
114120
<FacultyAdmin />,
115-
dispatchMessage
121+
dispatchMessage,
122+
testMetadata
116123
);
117124
await wait(() => getAllByRole('row').length > 1);
118125
const newAreaStyle = window.getComputedStyle(getByText('NA'));
@@ -127,7 +134,8 @@ describe('Faculty Admin', function () {
127134
it('displays the correct number of rows in the table (only the header row', async function () {
128135
const { getAllByRole } = render(
129136
<FacultyAdmin />,
130-
dispatchMessage
137+
dispatchMessage,
138+
testMetadata
131139
);
132140
await wait(() => getAllByRole('row').length === emptyTestData.length + 1);
133141
const rows = getAllByRole('row');
@@ -142,7 +150,8 @@ describe('Faculty Admin', function () {
142150
it('should throw an error', async function () {
143151
const { getAllByRole } = render(
144152
<FacultyAdmin />,
145-
dispatchMessage
153+
dispatchMessage,
154+
testMetadata
146155
);
147156
await wait(() => getAllByRole('row').length === emptyTestData.length + 1);
148157
strictEqual(dispatchMessage.callCount, 1);

0 commit comments

Comments
 (0)