@@ -18,6 +18,7 @@ import {
18
18
error ,
19
19
} from 'testData' ;
20
20
import { render } from 'test-utils' ;
21
+ import { testMetadata } from 'common/__tests__/data/metadata' ;
21
22
import FacultyAdmin from '../FacultyAdmin' ;
22
23
23
24
describe ( 'Faculty Admin' , function ( ) {
@@ -37,22 +38,25 @@ describe('Faculty Admin', function () {
37
38
it ( 'creates a table' , async function ( ) {
38
39
const { container } = render (
39
40
< FacultyAdmin /> ,
40
- dispatchMessage
41
+ dispatchMessage ,
42
+ testMetadata
41
43
) ;
42
44
return waitForElement ( ( ) => container . querySelector ( '.faculty-admin-table' ) ) ;
43
45
} ) ;
44
46
it ( 'creates the "create faculty" button' , async function ( ) {
45
47
const { container } = render (
46
48
< FacultyAdmin /> ,
47
- dispatchMessage
49
+ dispatchMessage ,
50
+ testMetadata
48
51
) ;
49
52
return waitForElement ( ( ) => container . querySelector ( '.create-faculty-button' ) ) ;
50
53
} ) ;
51
54
context ( 'when course data fetch succeeds' , function ( ) {
52
55
it ( 'displays the correct faculty information' , async function ( ) {
53
56
const { getByText } = render (
54
57
< FacultyAdmin /> ,
55
- dispatchMessage
58
+ dispatchMessage ,
59
+ testMetadata
56
60
) ;
57
61
strictEqual ( getStub . callCount , 1 ) ;
58
62
const { lastName } = bioengineeringFacultyMemberResponse ;
@@ -61,7 +65,8 @@ describe('Faculty Admin', function () {
61
65
it ( 'displays the correct number of rows in the table' , async function ( ) {
62
66
const { getAllByRole } = render (
63
67
< FacultyAdmin /> ,
64
- dispatchMessage
68
+ dispatchMessage ,
69
+ testMetadata
65
70
) ;
66
71
await wait ( ( ) => getAllByRole ( 'row' ) . length > 1 ) ;
67
72
const rows = getAllByRole ( 'row' ) ;
@@ -70,7 +75,8 @@ describe('Faculty Admin', function () {
70
75
it ( 'displays the correct content in the table cells' , async function ( ) {
71
76
const { getAllByRole } = render (
72
77
< FacultyAdmin /> ,
73
- dispatchMessage
78
+ dispatchMessage ,
79
+ testMetadata
74
80
) ;
75
81
await wait ( ( ) => getAllByRole ( 'row' ) . length > 1 ) ;
76
82
const rows = Array . from ( getAllByRole ( 'row' ) ) as HTMLTableRowElement [ ] ;
@@ -112,7 +118,8 @@ describe('Faculty Admin', function () {
112
118
it ( 'does not pass the backgroundColor prop when area does not exist' , async function ( ) {
113
119
const { getAllByRole, getByText } = render (
114
120
< FacultyAdmin /> ,
115
- dispatchMessage
121
+ dispatchMessage ,
122
+ testMetadata
116
123
) ;
117
124
await wait ( ( ) => getAllByRole ( 'row' ) . length > 1 ) ;
118
125
const newAreaStyle = window . getComputedStyle ( getByText ( 'NA' ) ) ;
@@ -127,7 +134,8 @@ describe('Faculty Admin', function () {
127
134
it ( 'displays the correct number of rows in the table (only the header row' , async function ( ) {
128
135
const { getAllByRole } = render (
129
136
< FacultyAdmin /> ,
130
- dispatchMessage
137
+ dispatchMessage ,
138
+ testMetadata
131
139
) ;
132
140
await wait ( ( ) => getAllByRole ( 'row' ) . length === emptyTestData . length + 1 ) ;
133
141
const rows = getAllByRole ( 'row' ) ;
@@ -142,7 +150,8 @@ describe('Faculty Admin', function () {
142
150
it ( 'should throw an error' , async function ( ) {
143
151
const { getAllByRole } = render (
144
152
< FacultyAdmin /> ,
145
- dispatchMessage
153
+ dispatchMessage ,
154
+ testMetadata
146
155
) ;
147
156
await wait ( ( ) => getAllByRole ( 'row' ) . length === emptyTestData . length + 1 ) ;
148
157
strictEqual ( dispatchMessage . callCount , 1 ) ;
0 commit comments