@@ -2,7 +2,7 @@ import { screen } from "@testing-library/react"
2
2
import React from "react"
3
3
import { render } from "../../test_helpers"
4
4
import { MockUser } from "../../test_helpers/entities"
5
- import { UserDropdown , UserDropdownProps } from "./UserDropdown"
5
+ import { Language , UserDropdown , UserDropdownProps } from "./UserDropdown"
6
6
7
7
const renderAndClick = async ( props :Partial < UserDropdownProps > = { } ) => {
8
8
render ( < UserDropdown user = { props . user ?? MockUser } onSignOut = { props . onSignOut ?? jest . fn ( ) } /> )
@@ -14,9 +14,9 @@ describe("UserDropdown", () => {
14
14
describe ( "when the trigger is clicked" , ( ) => {
15
15
it ( "opens the menu" , async ( ) => {
16
16
await renderAndClick ( )
17
- expect ( screen . getByText ( / a c c o u n t / i ) ) . toBeDefined ( )
18
- expect ( screen . getByText ( / d o c u m e n t a t i o n / i ) ) . toBeDefined ( )
19
- expect ( screen . getByText ( / s i g n o u t / i ) ) . toBeDefined ( )
17
+ expect ( screen . getByText ( Language . accountLabel ) ) . toBeDefined ( )
18
+ expect ( screen . getByText ( Language . docsLabel ) ) . toBeDefined ( )
19
+ expect ( screen . getByText ( Language . signOutLabel ) ) . toBeDefined ( )
20
20
} )
21
21
} )
22
22
@@ -25,7 +25,7 @@ describe("UserDropdown", () => {
25
25
it ( "calls the onSignOut function" , async ( ) => {
26
26
const onSignOut = jest . fn ( )
27
27
await renderAndClick ( { onSignOut} )
28
- screen . getByText ( / s i g n o u t / i ) . click ( )
28
+ screen . getByText ( Language . signOutLabel ) . click ( )
29
29
expect ( onSignOut ) . toBeCalledTimes ( 1 )
30
30
} )
31
31
} )
@@ -34,7 +34,7 @@ describe("UserDropdown", () => {
34
34
it ( "has the correct link for the documentation item" , async ( ) => {
35
35
await renderAndClick ( )
36
36
37
- const link = screen . getByText ( / d o c u m e n t a t i o n / i ) . closest ( "a" )
37
+ const link = screen . getByText ( Language . docsLabel ) . closest ( "a" )
38
38
if ( ! link ) {
39
39
throw new Error ( "Anchor tag not found for the documentation menu item" )
40
40
}
@@ -45,7 +45,7 @@ describe("UserDropdown", () => {
45
45
it ( "has the correct link for the account item" , async ( ) => {
46
46
await renderAndClick ( )
47
47
48
- const link = screen . getByText ( / a c c o u n t / i ) . closest ( "a" )
48
+ const link = screen . getByText ( Language . accountLabel ) . closest ( "a" )
49
49
if ( ! link ) {
50
50
throw new Error ( "Anchor tag not found for the account menu item" )
51
51
}