Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 915: Stop/start Location manager based on listeners registered. #999

Merged
merged 16 commits into from
Oct 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR review comment addressed
  • Loading branch information
soumyashisPR committed Sep 12, 2020
commit 0df8663626dfc11cff5549d9f6a3b182107f61c6
24 changes: 13 additions & 11 deletions __tests__/components/UserLocation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ describe('UserLocation', () => {

test('renders with CircleLayers by default', (done) => {
const {UNSAFE_getAllByType} = render(<UserLocation />);
const shapeSource = UNSAFE_getAllByType(ShapeSource);
const circleLayer = UNSAFE_getAllByType(CircleLayer);

expect(shapeSource.length).toBe(1);
expect(circleLayer.length).toBe(3);
done();
setTimeout(() => {
const shapeSource = UNSAFE_getAllByType(ShapeSource);
const circleLayer = UNSAFE_getAllByType(CircleLayer);

expect(shapeSource.length).toBe(1);
expect(circleLayer.length).toBe(3);
done();
});
});

test('does not render with visible set to false', (done) => {
Expand Down Expand Up @@ -115,12 +118,11 @@ describe('UserLocation', () => {
const {UNSAFE_queryByType} = render(
<UserLocation onPress={onPressCallback} />,
);
setTimeout(() => {
const shapeSource = UNSAFE_queryByType(ShapeSource);
fireEvent(shapeSource, 'onPress');
fireEvent(shapeSource, 'onPress');
expect(onPressCallback).toHaveBeenCalledTimes(2);
});

const shapeSource = UNSAFE_queryByType(ShapeSource);
fireEvent(shapeSource, 'onPress');
fireEvent(shapeSource, 'onPress');
expect(onPressCallback).toHaveBeenCalledTimes(2);
});

test('correctly unmounts', async () => {
Expand Down