Files
aicommits/tests/fixtures/testing-react-application.diff
2023-05-03 22:55:58 +09:00

23 lines
857 B
Diff

diff --git a/src/components/MyComponent.test.js b/src/components/MyComponent.test.js
index 37eabf2..976c6bf 100644
--- a/src/components/MyComponent.test.js
+++ b/src/components/MyComponent.test.js
@@ -10,6 +10,7 @@ describe("MyComponent", () => {
});
it("renders the component correctly", () => {
+ const props = { name: "John Doe", age: 25 };
const tree = renderer.create(<MyComponent {...props} />).toJSON();
expect(tree).toMatchSnapshot();
});
@@ -25,6 +26,11 @@ describe("MyComponent", () => {
expect(wrapper.find("h1").text()).toEqual("Hello, John Doe!");
});
+ it("displays the correct age", () => {
+ const props = { name: "Jane Doe", age: 30 };
+ const wrapper = shallow(<MyComponent {...props} />);
+ expect(wrapper.find("p").text()).toEqual("Age: 30");
+ });
});