Skip to content

Commit 326f12f

Browse files
Linda Penglpatmo
authored andcommitted
Fix tests (again)
1 parent 4fb6dc8 commit 326f12f

File tree

3 files changed

+47
-29
lines changed

3 files changed

+47
-29
lines changed

package-lock.json

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Auth/AuthForm.spec.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,17 @@ describe('Signup', () => {
8989
);
9090

9191
await act(async () => userEvent.click(screen.getByTestId('submitButton')));
92-
expect(screen.getByText('Username*').className).toContain('Mui-error');
93-
expect(screen.getByText('Email*').className).toContain('Mui-error');
94-
expect(screen.getByText('Password*').className).toContain('Mui-error');
92+
// expect(screen.getByText('Username').className).toContain('Mui-error');
93+
screen.debug();
94+
expect(
95+
screen.getByText('"Email" is not allowed to be empty')
96+
).toBeInTheDocument();
97+
expect(
98+
screen.getByText('"Username" is not allowed to be empty')
99+
).toBeInTheDocument();
100+
expect(
101+
screen.getByText('"Password" is not allowed to be empty')
102+
).toBeInTheDocument();
95103
});
96104

97105
it('Show username length validation error', async () => {

src/components/Auth/__snapshots__/AuthForm.spec.js.snap

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`AuthForm should render accordingly 1`] = `
44
<DocumentFragment>
55
<div
6-
class="MuiPaper-root MuiPaper-elevation3 MuiBox-root MuiBox-root-1 MuiPaper-rounded"
6+
class="MuiPaper-root MuiBox-root MuiBox-root-1 MuiPaper-elevation3 MuiPaper-rounded"
77
>
88
<form
99
autocomplete="off"
@@ -23,6 +23,7 @@ exports[`AuthForm should render accordingly 1`] = `
2323
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-marginDense MuiInputLabel-outlined"
2424
data-shrink="false"
2525
for="first-name"
26+
id="first-name-label"
2627
>
2728
First Name*
2829
</label>
@@ -40,14 +41,12 @@ exports[`AuthForm should render accordingly 1`] = `
4041
<fieldset
4142
aria-hidden="true"
4243
class="PrivateNotchedOutline-root-4 MuiOutlinedInput-notchedOutline"
43-
style="padding-left: 8px;"
4444
>
4545
<legend
46-
class="PrivateNotchedOutline-legend-5"
47-
style="width: 0.01px;"
46+
class="PrivateNotchedOutline-legendLabelled-6"
4847
>
4948
<span>
50-
49+
First Name*
5150
</span>
5251
</legend>
5352
</fieldset>
@@ -60,6 +59,7 @@ exports[`AuthForm should render accordingly 1`] = `
6059
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-marginDense MuiInputLabel-outlined"
6160
data-shrink="false"
6261
for="last-name"
62+
id="last-name-label"
6363
>
6464
Last Name
6565
</label>
@@ -77,14 +77,12 @@ exports[`AuthForm should render accordingly 1`] = `
7777
<fieldset
7878
aria-hidden="true"
7979
class="PrivateNotchedOutline-root-4 MuiOutlinedInput-notchedOutline"
80-
style="padding-left: 8px;"
8180
>
8281
<legend
83-
class="PrivateNotchedOutline-legend-5"
84-
style="width: 0.01px;"
82+
class="PrivateNotchedOutline-legendLabelled-6"
8583
>
8684
<span>
87-
85+
Last Name
8886
</span>
8987
</legend>
9088
</fieldset>
@@ -97,6 +95,7 @@ exports[`AuthForm should render accordingly 1`] = `
9795
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-marginDense MuiInputLabel-outlined"
9896
data-shrink="false"
9997
for="username"
98+
id="username-label"
10099
>
101100
Username*
102101
</label>
@@ -114,14 +113,12 @@ exports[`AuthForm should render accordingly 1`] = `
114113
<fieldset
115114
aria-hidden="true"
116115
class="PrivateNotchedOutline-root-4 MuiOutlinedInput-notchedOutline"
117-
style="padding-left: 8px;"
118116
>
119117
<legend
120-
class="PrivateNotchedOutline-legend-5"
121-
style="width: 0.01px;"
118+
class="PrivateNotchedOutline-legendLabelled-6"
122119
>
123120
<span>
124-
121+
Username*
125122
</span>
126123
</legend>
127124
</fieldset>
@@ -134,6 +131,7 @@ exports[`AuthForm should render accordingly 1`] = `
134131
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-marginDense MuiInputLabel-outlined"
135132
data-shrink="false"
136133
for="email"
134+
id="email-label"
137135
>
138136
Email*
139137
</label>
@@ -151,14 +149,12 @@ exports[`AuthForm should render accordingly 1`] = `
151149
<fieldset
152150
aria-hidden="true"
153151
class="PrivateNotchedOutline-root-4 MuiOutlinedInput-notchedOutline"
154-
style="padding-left: 8px;"
155152
>
156153
<legend
157-
class="PrivateNotchedOutline-legend-5"
158-
style="width: 0.01px;"
154+
class="PrivateNotchedOutline-legendLabelled-6"
159155
>
160156
<span>
161-
157+
Email*
162158
</span>
163159
</legend>
164160
</fieldset>
@@ -171,6 +167,7 @@ exports[`AuthForm should render accordingly 1`] = `
171167
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-marginDense MuiInputLabel-outlined"
172168
data-shrink="false"
173169
for="password"
170+
id="password-label"
174171
>
175172
Password*
176173
</label>
@@ -188,21 +185,19 @@ exports[`AuthForm should render accordingly 1`] = `
188185
<fieldset
189186
aria-hidden="true"
190187
class="PrivateNotchedOutline-root-4 MuiOutlinedInput-notchedOutline"
191-
style="padding-left: 8px;"
192188
>
193189
<legend
194-
class="PrivateNotchedOutline-legend-5"
195-
style="width: 0.01px;"
190+
class="PrivateNotchedOutline-legendLabelled-6"
196191
>
197192
<span>
198-
193+
Password*
199194
</span>
200195
</legend>
201196
</fieldset>
202197
</div>
203198
</div>
204199
<div
205-
class="MuiBox-root MuiBox-root-6"
200+
class="MuiBox-root MuiBox-root-8"
206201
>
207202
<button
208203
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary"
@@ -223,7 +218,7 @@ exports[`AuthForm should render accordingly 1`] = `
223218
<p>
224219
Already have an account?
225220
<button
226-
class="MuiBox-root MuiBox-root-7"
221+
class="MuiBox-root MuiBox-root-9"
227222
>
228223
Log in
229224
</button>

0 commit comments

Comments
 (0)