forked from baron/baron-sso
56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
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);
|
|
});
|
|
});
|
|
}
|