• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

karanshukla / navyfragen-app / 28328243735

28 Jun 2026 04:13PM UTC coverage: 98.55% (-0.3%) from 98.889%
28328243735

Pull #188

github

web-flow
Merge 0305f18fc into 758f24dff
Pull Request #188: add e2e testing

1923 of 2006 branches covered (95.86%)

Branch coverage included in aggregate %.

26 of 52 new or added lines in 4 files covered. (50.0%)

7187 of 7238 relevant lines covered (99.3%)

6.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.25
/client/src/api/authService.ts
1
import { useMutation, useQuery, UseQueryResult } from "@tanstack/react-query";
2

3
import { apiClient, ApiError } from "./apiClient";
4
import { queryClient } from "./queryClient";
5

6
/**
7
 * Represents a user profile on the client-side.
8
 * This interface is based on the app.bsky.actor.getProfile lexicon.
9
 * @see {@link https://docs.bsky.app/docs/api/app-bsky-actor-get-profile}
10
 */
11
export interface UserProfile {
12
  did?: string;
13
  handle?: string;
14
  displayName?: string;
15
  description?: string;
16
  avatar?: string;
17
  banner?: string;
18
}
19

20
export interface SessionResponse {
21
  isLoggedIn: boolean;
22
  profile: UserProfile | null;
23
  did: string | null;
24
}
25

26
export interface LoginRequest {
27
  handle: string;
28
}
29

30
export interface LoginResponse {
31
  redirectUrl: string;
32
}
33

34
export interface E2ELoginRequest {
35
  identifier: string;
36
  password: string;
37
}
38

39
export interface E2ELoginResponse {
40
  success: boolean;
41
}
42

43
export const authKeys = {
8✔
44
  session: ["auth", "session"] as const,
45
};
46

47
export const authService = {
8✔
48
  getSession: (): Promise<SessionResponse> => {
49
    return apiClient.get<SessionResponse>("/session");
2✔
50
  },
51

52
  login: async (data: LoginRequest): Promise<LoginResponse> => {
53
    return apiClient.post<LoginResponse, LoginRequest>("/login", data);
3✔
54
  },
55

56
  logout: async (): Promise<{ message: string }> => {
57
    return apiClient.post<{ message: string }>("/logout");
2✔
58
  },
59

60
  e2eLogin: async (data: E2ELoginRequest): Promise<E2ELoginResponse> => {
NEW
61
    return apiClient.post<E2ELoginResponse, E2ELoginRequest>("/auth/e2e-login", data);
×
62
  },
63
};
64

65
// React Query hooks
66
export function useSession(): UseQueryResult<SessionResponse, ApiError> {
67
  return useQuery({
2✔
68
    queryKey: authKeys.session,
69
    queryFn: () => authService.getSession(),
1✔
70
  });
71
}
72

73
export function useLogin() {
74
  return useMutation({
3✔
75
    mutationFn: (data: LoginRequest) => authService.login(data),
1✔
76
  });
77
}
78

79
export function useLogout() {
80
  return useMutation({
24✔
81
    mutationFn: () => authService.logout(),
1✔
82
    onSuccess: () => {
83
      // Invalidate the session query to force a refetch
84
      queryClient.invalidateQueries({ queryKey: authKeys.session });
1✔
85
      window.location.href = "/";
1✔
86
    },
87
  });
88
}
89

90
export function useE2ELogin() {
NEW
91
  return useMutation({
×
NEW
92
    mutationFn: (data: E2ELoginRequest) => authService.e2eLogin(data),
×
93
  });
94
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc