forked from baron/baron-sso
fix userfront verify link routing
This commit is contained in:
55
userfront/test/verification_route_policy_test.dart
Normal file
55
userfront/test/verification_route_policy_test.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:userfront/core/i18n/locale_registry.dart';
|
||||
import 'package:userfront/features/auth/domain/verification_completion_route.dart';
|
||||
|
||||
void main() {
|
||||
setUpAll(LocaleRegistry.primeWithDefaults);
|
||||
|
||||
group('verification route policy', () {
|
||||
test('루트 인증 payload는 전용 verify 라우트로 정리한다', () {
|
||||
final redirect = buildDedicatedVerificationRedirect(
|
||||
Uri.parse(
|
||||
'/?loginId=e2e%40example.com&code=654321&pendingRef=pending-root&utm=drop',
|
||||
),
|
||||
localeCode: 'ko',
|
||||
);
|
||||
|
||||
expect(
|
||||
redirect,
|
||||
'/ko/verify?loginId=e2e%40example.com&code=654321&pendingRef=pending-root',
|
||||
);
|
||||
});
|
||||
|
||||
test('signin 인증 payload도 로그인 화면에서 직접 소비하지 않는다', () {
|
||||
final redirect = buildDedicatedVerificationRedirect(
|
||||
Uri.parse('/ko/signin?t=magic-token&utm=drop'),
|
||||
localeCode: 'ko',
|
||||
);
|
||||
|
||||
expect(redirect, '/ko/verify?t=magic-token');
|
||||
});
|
||||
|
||||
test('인증 payload 여부를 식별한다', () {
|
||||
expect(hasVerificationPayload(Uri.parse('/?t=magic-token')), isTrue);
|
||||
expect(
|
||||
hasVerificationPayload(
|
||||
Uri.parse('/ko/signin?loginId=e2e%40example.com&code=654321'),
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
expect(
|
||||
hasVerificationPayload(Uri.parse('/ko/signin?code=654321')),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('이미 전용 verify 라우트면 다시 리다이렉트하지 않는다', () {
|
||||
final redirect = buildDedicatedVerificationRedirect(
|
||||
Uri.parse('/ko/verify?loginId=e2e%40example.com&code=654321'),
|
||||
localeCode: 'ko',
|
||||
);
|
||||
|
||||
expect(redirect, isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user