-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/merge files #1457
Merged
Merged
Feature/merge files #1457
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bfc9187
Endringer for sammenslåing av førsteside med søknad
nils-arne c18a36b
Endringer for sammenslåing av førsteside med søknad
nils-arne 9c96e17
Merge remote-tracking branch 'origin/tech/node-22' into feature/merge…
nils-arne c9f971d
Endringer for sammenslåing av førsteside med søknad
nils-arne 6b03d7b
Endringer for sammenslåing av førsteside med søknad
nils-arne f479706
Endringer for sammenslåing av førsteside med søknad
nils-arne 40c5caa
Endringer for sammenslåing av førsteside med søknad
nils-arne 54c8028
Endringer for sammenslåing av førsteside med søknad
nils-arne ea3970a
Endringer for sammenslåing av førsteside med søknad. Lagt til logging…
nils-arne 213bc4a
Endringer for sammenslåing av førsteside med søknad. Nais konfigurasjon
nils-arne 5ed31b3
Endringer for forberedelse til PR
nils-arne cab39ca
Merge remote-tracking branch 'origin/master' into feature/merge-files
nils-arne f26b881
Merging fra master og fikset pakke versjoner
nils-arne 0b922c2
Oppdatering etter PR. Midlertidig beholdt ubrukt kode for generering …
nils-arne f25f18c
Oppdatering etter PR. Fjernet ubrukt kode for å generere PDF av søkna…
nils-arne c549e45
Merge remote-tracking branch 'origin/master' into feature/merge-files
nils-arne 555f3e5
Merge branch 'master' into feature/merge-files
lotorvik 720a89e
Lagt til håndtering av språk ved kall til Gotenberg
nils-arne 5675c66
Merge remote-tracking branch 'origin/feature/merge-files' into featur…
nils-arne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
packages/fyllut-backend/src/routers/api/forsteside-soknad.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { ForstesideRequestBody, forstesideUtils } from '@navikt/skjemadigitalisering-shared-domain'; | ||
import { readFileSync } from 'fs'; | ||
import nock from 'nock'; | ||
import path from 'path'; | ||
import { config } from '../../config/config'; | ||
import { mockNext, mockRequest, mockResponse } from '../../test/requestTestHelpers'; | ||
import forstesideAndSoknad from './forsteside-soknad'; | ||
import * as mottaksadresser from './mottaksadresser'; | ||
|
||
const { skjemabyggingProxyUrl, formsApiUrl } = config; | ||
|
||
const addresses = [ | ||
{ | ||
_id: '6246de1afd03d2caeeda2825', | ||
data: { | ||
adresselinje1: 'Nav Arbeid og ytelser lønnsgaranti', | ||
adresselinje2: 'Postboks 6683 St. Olavs Plass', | ||
adresselinje3: '', | ||
postnummer: '0129', | ||
poststed: 'Oslo', | ||
temakoder: 'FOS,HJE', | ||
}, | ||
}, | ||
{ | ||
_id: '61c09f91ec962a0003c65014', | ||
data: { | ||
adresselinje1: 'Nav Skanning bidrag', | ||
adresselinje2: 'PB 6215 Etterstad', | ||
adresselinje3: '', | ||
postnummer: '0603', | ||
poststed: 'Oslo', | ||
}, | ||
}, | ||
]; | ||
|
||
const formTitle = 'testskjema'; | ||
const filePathForsteside = path.join(process.cwd(), '/src/routers/api/test-forsteside.pdf'); | ||
const filePathSoknad = path.join(process.cwd(), '/src/routers/api/test-skjema.pdf'); | ||
const filePathMerged = path.join(process.cwd(), '/src/routers/api/test-merged.pdf'); | ||
|
||
describe('[endpoint] forsteside', () => { | ||
beforeAll(() => { | ||
vi.spyOn(mottaksadresser, 'loadMottaksadresser').mockImplementation(async () => addresses); | ||
vi.spyOn(forstesideUtils, 'genererFoerstesideData').mockImplementation( | ||
() => | ||
({ | ||
foerstesidetype: 'ETTERSENDELSE', | ||
navSkjemaId: 'NAV 10.10.10', | ||
spraakkode: 'NB', | ||
overskriftstittel: 'Tittel', | ||
arkivtittel: 'Tittel', | ||
tema: 'HJE', | ||
}) as ForstesideRequestBody, | ||
); | ||
}); | ||
|
||
it('Create front page', async () => { | ||
const forstesidePdf = readFileSync(filePathForsteside); | ||
const soknadPdf = readFileSync(filePathSoknad); | ||
const mergedPdf = readFileSync(filePathMerged); | ||
const encodedForstesidedPdf = forstesidePdf.toString('base64'); | ||
const encodedSoknadPdf = soknadPdf.toString('base64'); | ||
|
||
const recipientsMock = nock(formsApiUrl).get('/v1/recipients').reply(200, []); | ||
const generateFileMock = nock(skjemabyggingProxyUrl!) | ||
.post('/foersteside') | ||
.reply(200, { foersteside: encodedForstesidedPdf }); | ||
const skjemabyggingproxyScope = nock(process.env.SKJEMABYGGING_PROXY_URL as string) | ||
.post('/exstream') | ||
.reply(200, { data: { result: [{ content: { data: encodedSoknadPdf } }] } }); | ||
|
||
const mergePdfScope = nock(process.env.GOTENBERG_URL as string) | ||
.intercept('/forms/pdfengines/merge', 'POST', (body) => { | ||
return body != null; | ||
}) | ||
.reply(200, mergedPdf, { 'content-type': 'application/pdf' }); | ||
|
||
const req = mockRequest({ | ||
headers: { | ||
AzureAccessToken: '', | ||
}, | ||
body: { | ||
form: JSON.stringify({ | ||
title: formTitle, | ||
components: [], | ||
properties: { mottaksadresseId: 'mottaksadresseId', path: '12345', skjemanummer: 'NAV 12.34-56' }, | ||
}), | ||
submissionMethod: 'paper', | ||
language: 'nb-NO', | ||
submission: JSON.stringify({ data: {} }), | ||
translations: JSON.stringify({}), | ||
}, | ||
}); | ||
|
||
await forstesideAndSoknad.post(req, mockResponse(), mockNext()); | ||
|
||
expect(recipientsMock.isDone()).toBe(true); | ||
expect(generateFileMock.isDone()).toBe(true); | ||
expect(skjemabyggingproxyScope.isDone()).toBe(true); | ||
expect(mergePdfScope.isDone()).toBe(true); | ||
}, 10000); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spesifiser versjon