mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
fix(suite-native): check correct urls for universal links
This commit is contained in:
@@ -251,7 +251,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
|
||||
{
|
||||
scheme: 'https',
|
||||
host: 'trezor.io',
|
||||
pathPattern: '/suite/deeplink/.*',
|
||||
pathPattern: '/suite/deeplinks/.*',
|
||||
},
|
||||
]
|
||||
: [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isProduction } from '@suite-native/config';
|
||||
|
||||
const TRADING_URL_BASE_PRODUCTION = 'https://trezor.io/suite/deeplink/trade';
|
||||
const TRADING_URL_BASE_PRODUCTION = 'https://trezor.io/suite/deeplinks/trade';
|
||||
const TRADING_URL_BASE_DEV = 'trezorsuite://trading';
|
||||
|
||||
// we don't want to expose custom scheme in production,
|
||||
|
||||
@@ -252,7 +252,7 @@ ${' '.repeat(16)}
|
||||
|
||||
it('should use production back URL in applyHtmlTemplate', () => {
|
||||
const html = applyHtmlTemplate('CONTENT_TO_EMBED');
|
||||
expect(html).toContain('href="https://trezor.io/suite/deeplink/trade/back"');
|
||||
expect(html).toContain('href="https://trezor.io/suite/deeplinks/trade/back"');
|
||||
});
|
||||
|
||||
it('should return correct url format with production base', () => {
|
||||
@@ -263,7 +263,7 @@ ${' '.repeat(16)}
|
||||
orderId: '1234',
|
||||
}),
|
||||
).toBe(
|
||||
'https://trezor.io/suite/deeplink/trade?action=quote&tradeType=buy&orderId=1234',
|
||||
'https://trezor.io/suite/deeplinks/trade?action=quote&tradeType=buy&orderId=1234',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,19 +67,19 @@ describe('utils', () => {
|
||||
});
|
||||
|
||||
it('should use production URL base', () => {
|
||||
expect(TRADING_URL_BASE).toBe('https://trezor.io/suite/deeplink/trade');
|
||||
expect(TRADING_URL_DEFAULT_BACK).toBe('https://trezor.io/suite/deeplink/trade/back');
|
||||
expect(TRADING_URL_BASE).toBe('https://trezor.io/suite/deeplinks/trade');
|
||||
expect(TRADING_URL_DEFAULT_BACK).toBe('https://trezor.io/suite/deeplinks/trade/back');
|
||||
});
|
||||
|
||||
it('should return true when URL contains production base', () => {
|
||||
const url =
|
||||
'https://trezor.io/suite/deeplink/trade?action=trade&tradeType=buy&orderId=123';
|
||||
'https://trezor.io/suite/deeplinks/trade?action=trade&tradeType=buy&orderId=123';
|
||||
expect(doesUrlContainCloseCallbackUrl(url, TRADING_URL_BASE)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true when URL contains production default back', () => {
|
||||
const url =
|
||||
'https://trezor.io/suite/deeplink/trade/back?action=trade&tradeType=buy&orderId=123';
|
||||
'https://trezor.io/suite/deeplinks/trade/back?action=trade&tradeType=buy&orderId=123';
|
||||
expect(doesUrlContainCloseCallbackUrl(url)).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user