Skip to content
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

Valider valgt navSelect-verdi i mellomlagret søknad #1020

Merged
merged 11 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
642 changes: 642 additions & 0 deletions mocks/mocks/data/formio-api/form-select-v1.json

Large diffs are not rendered by default.

549 changes: 549 additions & 0 deletions mocks/mocks/data/formio-api/form-select-v2.json

Large diffs are not rendered by default.

1,856 changes: 1,856 additions & 0 deletions mocks/mocks/data/formio-api/test-mellomlagring-v2.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"brukerId": "03876399856",
"skjemanr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"tema": "BIL",
"spraak": "nb",
"hoveddokument": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": true,
"mimetype": "application/pdf"
},
"hoveddokumentVariant": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": false,
"mimetype": "application/json",
"document": {
"language": "nb-NO",
"data": {
"data": {
"velgInstrument": {
"label": "Piano",
"value": "piano"
},
"velgLand": {
"label": "Italia",
"value": "IT"
},
"velgValutaDuVilBetaleMed": {
"label": "Euro (EUR)",
"value": "EUR"
}
},
"metadata": {
"timezone": "Europe/Oslo",
"offset": 60,
"origin": "https://fyllut-preprod.intern.dev.nav.no",
"referrer": "https://fyllut-preprod.intern.dev.nav.no/fyllut/testselect/paabegynt?sub=digital",
"browserName": "Netscape",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"pathName": "/fyllut/testselect/veiledning",
"onLine": true
},
"state": "submitted",
"_vnote": ""
}
}
},
"innsendingsId": "df6c8a69-9eb0-4878-b51f-38b3849ef9b6",
"status": "Opprettet",
"vedleggsListe": [],
"kanLasteOppAnnet": true,
"fristForEttersendelse": 14,
"endretDato": "2024-02-09T12:50:15.227151+01:00",
"skalSlettesDato": "2024-04-05",
"skjemaPath": "testselect",
"visningsType": "fyllUt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"brukerId": "03876399856",
"skjemanr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"tema": "BIL",
"spraak": "nb",
"hoveddokument": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": true,
"mimetype": "application/pdf"
},
"hoveddokumentVariant": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": false,
"mimetype": "application/json",
"document": {
"language": "nb-NO",
"data": {
"data": {
"velgInstrument": {
"label": "Piano",
"value": "piano"
},
"velgLand": {
"label": "Invalid country",
"value": "INVALID"
},
"velgValutaDuVilBetaleMed": {
"label": "Euro (EUR)",
"value": "EUR"
}
},
"metadata": {
"timezone": "Europe/Oslo",
"offset": 60,
"origin": "https://fyllut-preprod.intern.dev.nav.no",
"referrer": "https://fyllut-preprod.intern.dev.nav.no/fyllut/testselect/paabegynt?sub=digital",
"browserName": "Netscape",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"pathName": "/fyllut/testselect/veiledning",
"onLine": true
},
"state": "submitted",
"_vnote": ""
}
}
},
"innsendingsId": "df6c8a69-9eb0-4878-b51f-38b3849ef9b6",
"status": "Opprettet",
"vedleggsListe": [],
"kanLasteOppAnnet": true,
"fristForEttersendelse": 14,
"endretDato": "2024-02-09T12:50:15.227151+01:00",
"skalSlettesDato": "2024-04-05",
"skjemaPath": "testselect",
"visningsType": "fyllUt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"brukerId": "03876399856",
"skjemanr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"tema": "BIL",
"spraak": "nb",
"hoveddokument": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": true,
"mimetype": "application/pdf"
},
"hoveddokumentVariant": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": false,
"mimetype": "application/json",
"document": {
"language": "nb-NO",
"data": {
"data": {
"velgInstrument": {
"label": "Piano",
"value": "piano"
},
"velgLand": {
"label": "Italia",
"value": "IT"
},
"velgValutaDuVilBetaleMed": {
"label": "Euro (EUR)",
"value": "EUR"
}
},
"metadata": {
"timezone": "Europe/Oslo",
"offset": 60,
"origin": "https://fyllut-preprod.intern.dev.nav.no",
"referrer": "https://fyllut-preprod.intern.dev.nav.no/fyllut/testselect/paabegynt?sub=digital",
"browserName": "Netscape",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"pathName": "/fyllut/testselect/veiledning",
"onLine": true
},
"state": "submitted",
"_vnote": ""
}
}
},
"innsendingsId": "df6c8a69-9eb0-4878-b51f-38b3849ef9b6",
"status": "Opprettet",
"vedleggsListe": [],
"kanLasteOppAnnet": true,
"fristForEttersendelse": 14,
"endretDato": "2024-02-09T12:50:15.227151+01:00",
"skalSlettesDato": "2024-04-05",
"skjemaPath": "testselect",
"visningsType": "fyllUt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"brukerId": "03876399856",
"skjemanr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"tema": "BIL",
"spraak": "nb",
"hoveddokument": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": true,
"mimetype": "application/pdf"
},
"hoveddokumentVariant": {
"vedleggsnr": "Test-select",
"tittel": "Tester nedtrekksmeny",
"label": "Tester nedtrekksmeny",
"pakrevd": false,
"mimetype": "application/json",
"document": {
"language": "nb-NO",
"data": {
"data": {
"velgInstrument": {
"label": "Piano",
"value": "piano"
}
}
}
}
},
"innsendingsId": "df6c8a69-9eb0-4878-b51f-38b3849ef9b6",
"status": "Opprettet",
"vedleggsListe": [],
"kanLasteOppAnnet": true,
"fristForEttersendelse": 14,
"endretDato": "2024-02-09T12:36:59.940133+01:00",
"skalSlettesDato": "2024-04-05",
"skjemaPath": "testselect",
"visningsType": "fyllUt"
}
31 changes: 30 additions & 1 deletion mocks/mocks/routes/formio-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const formCustomCompsDatagrid = require('../data/formio-api/custom-components-da
const formNavdatepicker = require('../data/formio-api/navdatepicker.json');
const formSubmissionMethod = require('../data/formio-api/submission-method.json');
const formTestMellomlagring = require('../data/formio-api/test-mellomlagring.json');
const formTestMellomlagringV2 = require('../data/formio-api/test-mellomlagring-v2.json');
const formSelectV1 = require('../data/formio-api/form-select-v1.json');
const formSelectV2 = require('../data/formio-api/form-select-v2.json');
const formTestPrefillData = require('../data/formio-api/prefill-data.json');
const translationsCypress101 = require('../data/formio-api/cypress101-translation.json');
const translationsConditionalXmas = require('../data/formio-api/conditionalxmas-translation.json');
Expand All @@ -25,8 +28,9 @@ const allForms = [
{ form: formCustomCompsAlert, translations: undefined },
{ form: formNavdatepicker, translations: undefined },
{ form: formSubmissionMethod, translations: translationsSubmissionMethod },
{ form: formTestMellomlagring, translations: undefined },
{ form: formTestMellomlagring, formV2: formTestMellomlagringV2, translations: undefined },
{ form: formTestPrefillData, translations: undefined },
{ form: formSelectV1, formV2: formSelectV2, translations: undefined },
];

const findTestdata = (formPath) => allForms.find((testdata) => testdata.form.path === formPath);
Expand Down Expand Up @@ -61,6 +65,31 @@ module.exports = [
},
},
},
{
id: 'success-v2',
type: 'middleware',
options: {
middleware: (req, res) => {
const formPath = req.query.path;
if (formPath) {
const testdata = findTestdata(formPath);
const form = testdata?.formV2 ?? testdata?.form;
if (form) {
res.status(200);
res.contentType('application/json; charset=UTF-8');
res.send([form]);
} else {
res.status(404);
res.send();
}
} else {
res.status(200);
res.contentType('application/json; charset=UTF-8');
res.send(allForms.map((obj) => obj.formV2 ?? obj.form).filter((form) => !!form));
}
},
},
},
],
},
{
Expand Down
36 changes: 36 additions & 0 deletions mocks/mocks/routes/innsending-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const prefillDataNames = require('../data/innsending-api/prefill-data/prefill-da
const paabegyntMellomlagringOgInnsendt = require('../data/innsending-api/active-tasks/mellomlagringOgEttersending.json');
const paabegyntMellomlagring = require('../data/innsending-api/active-tasks/mellomlagring.json');
const paabegyntInnsendt = require('../data/innsending-api/active-tasks/ettersending.json');
const formSelectSoknadPartialV1 = require('../data/innsending-api/mellomlagring/form-select/saved-partial-v1.json');
const formSelectSoknadCompleteV1 = require('../data/innsending-api/mellomlagring/form-select/saved-complete-v1.json');
const formSelectSoknadInvalidCountryV1 = require('../data/innsending-api/mellomlagring/form-select/saved-invalid-country-v1.json');
const formSelectSoknadInvalidInstrumentV1 = require('../data/innsending-api/mellomlagring/form-select/saved-invalid-instrument-v2.json');

const objectToByteArray = (obj) => Array.from(new TextEncoder().encode(JSON.stringify(obj)));

Expand Down Expand Up @@ -179,6 +183,38 @@ module.exports = [
body: convertToInnsendingApiResponse(prefillDataNames),
},
},
{
id: 'form-select-partial-v1',
type: 'json',
options: {
status: 200,
body: convertToInnsendingApiResponse(formSelectSoknadPartialV1),
},
},
{
id: 'form-select-complete-v1',
type: 'json',
options: {
status: 200,
body: convertToInnsendingApiResponse(formSelectSoknadCompleteV1),
},
},
{
id: 'form-select-invalid-country-v1',
type: 'json',
options: {
status: 200,
body: convertToInnsendingApiResponse(formSelectSoknadInvalidCountryV1),
},
},
{
id: 'form-select-invalid-instrument-v1',
type: 'json',
options: {
status: 200,
body: convertToInnsendingApiResponse(formSelectSoknadInvalidInstrumentV1),
},
},
{
id: 'not-found',
type: 'json',
Expand Down
Loading
Loading