Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
enzyme-to-json-mock-props
Advanced tools
it gives you the ability to mock props generated via enzyme-to-json
it gives you the ability to mock props generated via
enzyme-to-json
.
npm install enzyme-to-json-mock-props
Assuming you are using enzyme-to-json/serializer
as snapshotSerializers
, example.
import * as React from "react";
import { shallow } from "enzyme";
import mockProps from "enzyme-to-json-mock-props";
const SubComponent = () => <div />;
const Component = props => (
<SubComponent {...props} style={{ background: "red", color: "black" }} />
);
describe("my snapshot", () => {
const props = {
foo: {
bar: 123
},
foobar: "asd",
asd: {
qwe: 321
}
};
it("should render properly", () => {
const wrapper = shallow(<Component {...props} />);
expect(
mockProps(wrapper, ["foo", "foobar", "style", "qwe"])
).toMatchSnapshot();
});
});
before (without mockProps
):
exports[`enzyme-to-json-mock-props should render properly 1`] = `
<SubComponent
asd={
Object {
"qwe": 321,
}
}
foo={
Object {
"bar": 123,
}
}
foobar="asd"
style={
Object {
"background": "red",
"color": "black",
}
}
/>
`;
after (with mockProps
):
exports[`enzyme-to-json-mock-props should mock the indicated props 1`] = `
<SubComponent
asd={
Object {
"qwe": 321,
}
}
foo="[foo]"
foobar="[foobar]"
style="[style]"
/>
`;
FAQs
it gives you the ability to mock props generated via enzyme-to-json
The npm package enzyme-to-json-mock-props receives a total of 0 weekly downloads. As such, enzyme-to-json-mock-props popularity was classified as not popular.
We found that enzyme-to-json-mock-props demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.