diff --git a/backend/src/fiches/count-by-statut/count-by-statut.router.e2e-spec.ts b/backend/src/fiches/count-by-statut/count-by-statut.router.e2e-spec.ts index e52e23c9e2..29fc93d596 100644 --- a/backend/src/fiches/count-by-statut/count-by-statut.router.e2e-spec.ts +++ b/backend/src/fiches/count-by-statut/count-by-statut.router.e2e-spec.ts @@ -1,7 +1,7 @@ +import { AuthenticatedUser } from './../../auth/models/auth.models'; import { inferProcedureInput } from '@trpc/server'; import { getYoloDodoUser } from '../../../test/auth/auth-utils'; import { getTestRouter } from '../../../test/common/app-utils'; -import { User } from '../../auth/models/auth.models'; import { AppRouter, TrpcRouter } from '../../trpc/trpc.router'; import { FicheActionStatutsEnumType } from '../models/fiche-action.table'; @@ -9,7 +9,7 @@ type Input = inferProcedureInput; describe('CountByStatutRouter', () => { let router: TrpcRouter; - let yoloDodoUser: User; + let yoloDodoUser: AuthenticatedUser; beforeAll(async () => { router = await getTestRouter(); diff --git a/backend/src/indicateurs/controllers/indicateurs.controller.ts b/backend/src/indicateurs/controllers/indicateurs.controller.ts index 6b1e22abdf..147844a169 100644 --- a/backend/src/indicateurs/controllers/indicateurs.controller.ts +++ b/backend/src/indicateurs/controllers/indicateurs.controller.ts @@ -35,7 +35,6 @@ export class IndicateursController { @Query() request: GetIndicateursValeursRequestClass, @TokenInfo() tokenInfo: AuthenticatedUser ): Promise { - console.log('tokenInfo', tokenInfo); return this.indicateurService.getIndicateurValeursGroupees( request, tokenInfo diff --git a/backend/test/auth/auth-utils.ts b/backend/test/auth/auth-utils.ts index 5f379e3672..9bce5048e6 100644 --- a/backend/test/auth/auth-utils.ts +++ b/backend/test/auth/auth-utils.ts @@ -1,5 +1,9 @@ import { createClient, SupabaseClient } from '@supabase/supabase-js'; import { YOLO_DODO_CREDENTIALS } from './test-users.samples'; +import { + AuthUser, + isAuthenticatedUser, +} from '../../src/auth/models/auth.models'; let supabase: SupabaseClient; @@ -30,5 +34,15 @@ export async function getYoloDodoUser() { expect.fail('Could not authenticated user yolododo'); } - return user; + const authUser = { + id: user.id, + role: user.role, + isAnonymous: user.is_anonymous, + } as AuthUser; + + if (!isAuthenticatedUser(authUser)) { + expect.fail('Could not authenticated user yolododo'); + } + + return authUser; }