Kakao 인가·토큰 단계 실패를 로그인 실패로 처리 · 실패 원인 로그
This commit is contained in:
@@ -6,6 +6,8 @@ import 'package:fancake/features/auth/social_providers.dart';
|
||||
import 'package:firebase_auth_mocks/firebase_auth_mocks.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart'
|
||||
as kakao_sdk;
|
||||
|
||||
/// 카카오 — SDK 로그인(주입) → 서버 교환(주입) → signInWithCustomToken 계약.
|
||||
/// 토큰 검증·기존 oidc.kakao 사용자 매핑은 서버 테스트(functions/test/auth_kakao.test.ts)가 본다.
|
||||
@@ -61,6 +63,23 @@ void main() {
|
||||
expect(sent, isEmpty);
|
||||
});
|
||||
|
||||
test('카카오 인가 · 토큰 단계 실패는 로그인 실패(E-AUTH-03) · 서버를 부르지 않는다', () async {
|
||||
for (final error in [
|
||||
kakao_sdk.KakaoAuthException(
|
||||
kakao_sdk.AuthErrorCause.misconfigured,
|
||||
'KOE',
|
||||
),
|
||||
kakao_sdk.KakaoClientException(kakao_sdk.ClientErrorCause.unknown, 'sdk'),
|
||||
]) {
|
||||
final outcome = await kakao(
|
||||
MockFirebaseAuth(),
|
||||
token: () async => throw error,
|
||||
).signIn();
|
||||
expect((outcome as AuthFailed).code, 'E-AUTH-03', reason: '$error');
|
||||
}
|
||||
expect(sent, isEmpty);
|
||||
});
|
||||
|
||||
test('서버 오류는 카탈로그 코드로 · 로그인하지 않는다', () async {
|
||||
final auth = MockFirebaseAuth();
|
||||
final outcome = await kakao(
|
||||
|
||||
Reference in New Issue
Block a user