@@ -24,8 +24,10 @@ describe("SideNote Component", () => {
24
24
< div > Child content</ div >
25
25
</ SideNote >
26
26
) ;
27
- expect ( getByText ( "Title" ) ) . toBeInTheDocument ( ) ;
28
- expect ( getByText ( "Child content" ) ) . toBeInTheDocument ( ) ;
27
+ const title = getByText ( "Title" ) ;
28
+ const child = getByText ( "Child content" )
29
+ expect ( title ) . toBeInTheDocument ( ) ;
30
+ expect ( child ) . toBeInTheDocument ( ) ;
29
31
} ) ;
30
32
31
33
it ( "renders action button and handles click event" , ( ) => {
@@ -51,8 +53,10 @@ describe("SideNote Component", () => {
51
53
52
54
it ( "renders only title when children are not provided" , ( ) => {
53
55
const { getByText, queryByText } = render ( < SideNote title = "Title" /> ) ;
54
- expect ( getByText ( "Title" ) ) . toBeInTheDocument ( ) ;
55
- expect ( queryByText ( "Child content" ) ) . toBeNull ( ) ;
56
+ const title = getByText ( "Title" ) ;
57
+ const child = queryByText ( "Child content" ) ;
58
+ expect ( title ) . toBeInTheDocument ( ) ;
59
+ expect ( child ) . toBeNull ( ) ;
56
60
} ) ;
57
61
58
62
it ( "renders only children when title is not provided" , ( ) => {
@@ -61,8 +65,10 @@ describe("SideNote Component", () => {
61
65
< div > Child content</ div >
62
66
</ SideNote >
63
67
) ;
64
- expect ( getByText ( "Child content" ) ) . toBeInTheDocument ( ) ;
65
- expect ( queryByText ( "Title" ) ) . toBeNull ( ) ;
68
+ const title = queryByText ( "Title" ) ;
69
+ const child = getByText ( "Child content" ) ;
70
+ expect ( child ) . toBeInTheDocument ( ) ;
71
+ expect ( title ) . toBeNull ( ) ;
66
72
} ) ;
67
73
68
74
it ( "renders action button with default label if no actionLabel provided" , ( ) => {
@@ -71,7 +77,8 @@ describe("SideNote Component", () => {
71
77
< div > Child content</ div >
72
78
</ SideNote >
73
79
) ;
74
- expect ( getByText ( "Learn more" ) ) . toBeInTheDocument ( ) ;
80
+ const action = getByText ( "Learn more" )
81
+ expect ( action ) . toBeInTheDocument ( ) ;
75
82
} ) ;
76
83
77
84
} ) ;
0 commit comments