File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,24 @@ describe('Login Page Renders', () => {
56
56
// should ensure the login button has been clicked
57
57
expect ( loginButton2 ) . toBeCalled ;
58
58
// should ensure that the authenticate user function invoked by button click is called
59
- expect ( authenticateUser ) . toBeCalled ;
59
+ expect ( authenticateUser ) . toHaveBeenCalled ;
60
+ } ) ;
61
+
62
+ test ( 'Register Button navigates to Sign Up Page' , async ( ) => {
63
+ // select the register button
64
+ const registerButton = screen . getByRole ( 'register' ) ;
65
+ // fire event to click the button, navigating to new page
66
+ await act ( ( ) => {
67
+ fireEvent . click ( registerButton ) ;
68
+ } ) ;
69
+ // assert that the event happened
70
+ expect ( registerButton ) . toBeCalled ;
71
+
72
+ // on new page, select the title h1 element -> 'Sign Up'
73
+ const title = document . querySelector ( 'h1' ) ;
74
+
75
+ // assert that the title element has the SIgn Up text
76
+ expect ( title . textContent ) . toBe ( 'Sign Up' ) ;
60
77
} ) ;
61
78
62
79
test ( 'Docketeer Image' , async ( ) => {
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ const Login = () => {
118
118
< Button
119
119
variant = 'contained'
120
120
size = 'small'
121
+ role = 'register'
121
122
className = 'register login-buttons'
122
123
onClick = { ( ) => navigate ( '/userSignup' ) }
123
124
sx = { {
You can’t perform that action at this time.
0 commit comments