Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SebCourvoisier committed Dec 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8785a8b commit 9498f20
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/api/usecase/saveDecision.usecase.spec.ts
Original file line number Diff line number Diff line change
@@ -34,10 +34,12 @@ describe('SaveDecision Usecase', () => {
;(fs.writeFileSync as jest.Mock).mockImplementation(() => {})
metadonnees.date = new Date().toISOString()
await usecase.putDecision(fichierDecisionIntegre, 'test', metadonnees)
const now = new Date()
now.setMilliseconds(0)
const requestDto = {
texteDecisionIntegre: 'test',
metadonnees,
date: new Date().toISOString()
date: now.toISOString()
}
expect(mockDecisionRepository.saveDataDecisionIntegre).toHaveBeenCalledWith(
JSON.stringify(requestDto),
5 changes: 4 additions & 1 deletion src/api/usecase/saveDecision.usecase.ts
Original file line number Diff line number Diff line change
@@ -19,10 +19,13 @@ export class SaveDecisionUsecase {
const jsonFileName = `${uuid}.json`
const pdfFileName = `${uuid}${process.env.S3_PDF_FILE_NAME_SEPARATOR}${originalFileName}`

const now = new Date()
now.setMilliseconds(0)

const requestDto: CollectDto = {
texteDecisionIntegre,
metadonnees,
date: new Date()
date: now
}

await this.decisionsRepository.saveDataDecisionIntegre(
Original file line number Diff line number Diff line change
@@ -46,12 +46,14 @@ export class DecisionS3Repository implements DecisionRepository {
originalPdfFileName: string,
jsonS3Key: string
): Promise<void> {
const now = new Date()
now.setMilliseconds(0)
const reqParams = {
Body: requestToS3Dto,
Bucket: process.env.S3_BUCKET_NAME_RAW,
Key: `${jsonS3Key}`,
Metadata: {
date: new Date().toISOString(),
date: now.toISOString(),
originalPdfFileName: originalPdfFileName
}
}

0 comments on commit 9498f20

Please sign in to comment.