Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const count = 12;
getOpenedPuzzleCount.mockReturnValue(Promise.resolve(count));
const testInstance = TestRenderer.create(
);
// Initial Count
expect(testInstance.toJSON()).toEqual(`${initialCount}`);
// Updated Count with native bridge
await delay(0);
expect(testInstance.toJSON()).toEqual(`${count}`);
});
};
it("check that the event default is properly prevented", async () => {
const testInstance = TestRenderer.create(
);
const [saveStarLink] = testInstance.root.findAllByType(Link);
await delay(0);
const preventDefault = jest.fn();
saveStarLink.props.onPress({ preventDefault });
expect(preventDefault).toHaveBeenCalled();
});
});
test: async () => {
const testInstance = TestRenderer.create(
{}}
delay={1}
message="test message"
scale={scales.medium}
/>
);
await delay(500);
expect(testInstance.toJSON()).toMatchSnapshot();
}
},
await delay(0);
expect(testInstance.toJSON()).toMatchSnapshot("initial sync");
const [
{
props: { onPress }
}
] = testInstance.root.findAllByType(View);
onPress(true, "789");
await delay(0);
expect(testInstance.toJSON()).toMatchSnapshot("save article 789");
onPress(false, "456");
await delay(0);
expect(testInstance.toJSON()).toMatchSnapshot("unsave article 456");
});
test: async () => {
const closed = jest.fn();
const testInstance = shallow(
);
const button = testInstance.find(TouchableOpacity);
button.simulate("press");
await delay(10);
expect(closed).toBeCalled();
}
},