Skip to content

Commit 2e41afb

Browse files
test : mde changes in test cases
1 parent 9be235f commit 2e41afb

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/components/SideNote/__test__/SideNote.spec.tsx

+14-7
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ describe("SideNote Component", () => {
2424
<div>Child content</div>
2525
</SideNote>
2626
);
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();
2931
});
3032

3133
it("renders action button and handles click event", () => {
@@ -51,8 +53,10 @@ describe("SideNote Component", () => {
5153

5254
it("renders only title when children are not provided", () => {
5355
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();
5660
});
5761

5862
it("renders only children when title is not provided", () => {
@@ -61,8 +65,10 @@ describe("SideNote Component", () => {
6165
<div>Child content</div>
6266
</SideNote>
6367
);
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();
6672
});
6773

6874
it("renders action button with default label if no actionLabel provided", () => {
@@ -71,7 +77,8 @@ describe("SideNote Component", () => {
7177
<div>Child content</div>
7278
</SideNote>
7379
);
74-
expect(getByText("Learn more")).toBeInTheDocument();
80+
const action = getByText("Learn more")
81+
expect(action).toBeInTheDocument();
7582
});
7683

7784
});

0 commit comments

Comments
 (0)