Skip to content

Commit

Permalink
Merge pull request #250 from lorenc-tomasz/Fix-Moovit-detection-on-An…
Browse files Browse the repository at this point in the history
…droid
  • Loading branch information
tschoffelen authored Jun 4, 2023
2 parents a57721a + 05d6633 commit 60f9016
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function generatePrefixes(options) {
truckmap: 'truckmap://',
waze: 'waze://',
yandex: 'yandexnavi://',
moovit: 'moovit://',
moovit: 'moovit://directions',
'yandex-maps': 'yandexmaps://maps.yandex.ru/',
'yandex-taxi': 'yandextaxi://',
kakaomap: 'kakaomap://',
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export async function showLocation(options) {
}
break;
case 'moovit':
url = `${prefixes.moovit}directions?dest_lat=${lat}&dest_lon=${lng}`;
url = `${prefixes.moovit}?dest_lat=${lat}&dest_lon=${lng}`;

if (title) {
url += `&dest_name=${encodedTitle}`;
Expand Down
9 changes: 0 additions & 9 deletions tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {showLocation} from '../src/index';
import {Linking} from 'react-native';

jest.mock('react-native', () => ({
Linking: {
openURL: jest.fn(),
},
Platform: {
OS: 'ios',
},
}));

describe('showLocation', () => {
const latitude = 123;
const longitude = 234;
Expand Down
16 changes: 12 additions & 4 deletions tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
jest.mock('react-native/Libraries/Linking/Linking', () => ({
canOpenURL: jest.fn((url) => {
return Promise.resolve(url.includes('https://') || url.includes('uber://'));
}),
jest.mock('react-native', () => ({
Linking: {
openURL: jest.fn(),
canOpenURL: jest.fn((url) => {
return Promise.resolve(
url.includes('https://') || url.includes('uber://'),
);
}),
},
Platform: {
OS: 'ios',
},
}));

0 comments on commit 60f9016

Please sign in to comment.