Skip to content

Convert ServiceChain plugin to NestJS module#2019

Open
StephaneTrebel wants to merge 4 commits intomainfrom
convert-opencds-nestjs
Open

Convert ServiceChain plugin to NestJS module#2019
StephaneTrebel wants to merge 4 commits intomainfrom
convert-opencds-nestjs

Conversation

@StephaneTrebel
Copy link
Copy Markdown
Collaborator

Issues liées

Issues numéro: #1983

@StephaneTrebel StephaneTrebel added this to the MCO milestone Mar 20, 2026
@StephaneTrebel StephaneTrebel self-assigned this Mar 20, 2026
@github-actions github-actions bot added the built label Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

🤖 Hey !

The security scan report for the current pull request is available here.

@cloud-pi-native-sonarqube
Copy link
Copy Markdown

Failed Quality Gate failed

  • 0.00% Security Hotspots Reviewed on New Code (is less than 100.00%)

Project ID: cloud-pi-native_console_AYsa46O31ebDtzs-pYyZ

View in SonarQube

@StephaneTrebel StephaneTrebel force-pushed the convert-opencds-nestjs branch 2 times, most recently from fb683c2 to 4e7ad49 Compare March 26, 2026 14:33
@StephaneTrebel StephaneTrebel changed the title Convert opencds plugin to NestJS module Convert ServiceChain plugin to NestJS module Mar 26, 2026
@StephaneTrebel StephaneTrebel force-pushed the convert-opencds-nestjs branch 3 times, most recently from 1f719cd to 8f6bfdc Compare March 26, 2026 15:27
@StephaneTrebel StephaneTrebel added the preview Deploy preview app with Argo-cd label Mar 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hey !

A preview of the application is available at : https://console-pr-2019.dso.cpin-hp.numerique-interieur.fr

Please be patient, deployment may take a few minutes.

@StephaneTrebel StephaneTrebel force-pushed the convert-opencds-nestjs branch from 8f6bfdc to 8d74ca8 Compare March 30, 2026 07:27
Copy link
Copy Markdown
Member

@shikanime shikanime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On utilise NestJS, autant reellement utiliser le framework a fond via @nestjs/testing avec un typage fort jusqu'au mocks. J'ai eux pas mal d'occasion ou les mocks n'etait plus en sync avec les implementations reel qui ont fausse les tests


beforeEach(() => {
prisma = makePrisma()
service = new AuthService(prisma as any)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour les dépendances tierces, j'utilisais spécifiquement "vitest-mock-extended". Pour nos dépendances, j'utilisais principalement satisfies Partial<xxxService>; sans, les changements sur la classe principale ne seront pas détectés par TypeScript sur les mocks.

Comment on lines +5 to +8
vi.mock('../infrastructure/telemetry/telemetry.decorator', () => ({
StartActiveSpan: () => (_target: any, _key: string, descriptor: PropertyDescriptor) => descriptor,
}))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test.createTestingModule peut permettre de mock les modules via la DI.

service = new ServiceChainService(config)
})

function mockClient(response: any) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas refacto-friendly, on devrait typer ca dans un service et l'injecter via la DI.

import axios from 'axios'
import { StartActiveSpan } from '../infrastructure/telemetry/telemetry.decorator'

const openCdsDisabledMessage = 'OpenCDS is disabled, please set OPENCDS_URL in your relevant .env file. See .env-example'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built preview Deploy preview app with Argo-cd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants