refactor: hardcode Bowli mobile scheme
This commit is contained in:
@@ -12,7 +12,6 @@ uses(RefreshDatabase::class);
|
||||
|
||||
it('sends engagement reminders only to eligible mobile users', function () {
|
||||
app()->setLocale('fr');
|
||||
config()->set('app.mobile_scheme', 'dailymeal');
|
||||
|
||||
Http::fake([
|
||||
'https://exp.host/*' => Http::response([
|
||||
@@ -63,15 +62,13 @@ it('sends engagement reminders only to eligible mobile users', function () {
|
||||
return $payload['to'] === 'ExponentPushToken[eligible]'
|
||||
&& $payload['data']['type'] === 'engagement_reminder'
|
||||
&& in_array($payload['data']['url'], [
|
||||
'dailymeal://create',
|
||||
'dailymeal://profile/workouts?create=1',
|
||||
'bowli://create',
|
||||
'bowli://profile/workouts?create=1',
|
||||
], true);
|
||||
});
|
||||
});
|
||||
|
||||
it('uses the hard-coded localized reminder copy', function () {
|
||||
config()->set('app.mobile_scheme', 'dailymeal');
|
||||
|
||||
foreach (['fr', 'en'] as $locale) {
|
||||
app()->setLocale($locale);
|
||||
|
||||
@@ -86,18 +83,12 @@ it('uses the hard-coded localized reminder copy', function () {
|
||||
expect($payload['title'])->toBeString()->not->toBeEmpty()
|
||||
->and($payload['body'])->toBeString()->not->toBeEmpty()
|
||||
->and($payload['data']['message_key'])->toBe($messageKey)
|
||||
->and($payload['data']['url'])->toBe("dailymeal://{$expectedPath}");
|
||||
->and($payload['data']['url'])->toBe("bowli://{$expectedPath}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('builds mobile deep links from the configured scheme', function () {
|
||||
config()->set('app.mobile_scheme', 'dailymeal://');
|
||||
|
||||
expect(MobileDeepLink::to('/create'))->toBe('dailymeal://create')
|
||||
->and(MobileDeepLink::to('strava/callback', ['code' => 'abc 123']))->toBe('dailymeal://strava/callback?code=abc%20123');
|
||||
|
||||
config()->set('app.mobile_scheme', '');
|
||||
|
||||
expect(MobileDeepLink::to('create'))->toBe('bowly://create');
|
||||
it('builds mobile deep links with the Bowli scheme', function () {
|
||||
expect(MobileDeepLink::to('/create'))->toBe('bowli://create')
|
||||
->and(MobileDeepLink::to('strava/callback', ['code' => 'abc 123']))->toBe('bowli://strava/callback?code=abc%20123');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user