Skip to content

Instantly share code, notes, and snippets.

@janhesters
Created October 3, 2018 13:36
Show Gist options
  • Save janhesters/19fad5cc95b2e2e9a858149eb133e485 to your computer and use it in GitHub Desktop.
Save janhesters/19fad5cc95b2e2e9a858149eb133e485 to your computer and use it in GitHub Desktop.
describe("rendering", () => {
let wrapper: ShallowWrapper;
let props: Props;
let Platform: PlatformStatic;
beforeEach(() => {
props = createTestProps({});
wrapper = shallow(<LoginScreen {...props} />);
Platform = require("react-native").Platform;
});
// ... other tests
it("should render a <KeyboardAvoidingView />", () => {
expect(wrapper.find("KeyboardAvoidingView")).toHaveLength(1);
});
describe("<KeyboardAvoidingView />'s behavior on iOS", () => {
beforeEach(() => {
Platform.OS = "ios";
});
it("should have a 'behavior' prop of 'padding'", () => {
expect(wrapper.find("KeyboardAvoidingView").prop("behavior")).toBe("padding");
});
});
describe("<KeyboardAvoidingView />'s behavior on Android", () => {
beforeEach(() => {
Platform.OS = "android";
});
it("should NOT have a behavior prop", () => {
expect(wrapper.find("KeyboardAvoidingView").prop("behavior")).toBe(undefined);
});
});
// ... more other tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment