import 'package:flutter_test/flutter_test.dart';
import 'package:userfront/features/auth/presentation/qr_scan_route.dart';

void main() {
  group('buildQrApprovePath', () {
    test('스캔 값을 trim/encode 해서 approve 경로를 만든다', () {
      final result = buildQrApprovePath(
        '  https://sss.hmac.kr/ql/abc-123?x=1&y=2  ',
        localeCode: 'ko',
      );

      expect(
        result,
        '/ko/approve?ref=https%3A%2F%2Fsss.hmac.kr%2Fql%2Fabc-123%3Fx%3D1%26y%3D2',
      );
    });

    test('현재 URI에서 locale을 추출한다', () {
      final result = buildQrApprovePath(
        'abc123',
        currentUri: Uri.parse('https://sss.hmac.kr/en/dashboard'),
      );

      expect(result, '/en/approve?ref=abc123');
    });
  });
}
