Skip to content

Commit

Permalink
Vaihdettu feilaavat valintalaskennan käynnistys-kutsut
Browse files Browse the repository at this point in the history
  • Loading branch information
pretseli committed Nov 20, 2024
1 parent 6329769 commit b4186e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/app/lib/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const configuration = {
hakukohteetUrl: `${DOMAIN}/kouta-internal/hakukohde/search?all=false`,
hakukohdeUrl: `${DOMAIN}/kouta-internal/hakukohde`,
kooditUrl: `${DOMAIN}/koodisto-service/rest/codeelement/codes/`,
koodiUrl: (codeElementUri: string) =>
`${DOMAIN}/koodisto-service/rest/codeelement/latest/${codeElementUri}`,
koutaInternalLogin: `${DOMAIN}/kouta-internal/auth/login`,
asiointiKieliUrl: `${DOMAIN}/oppijanumerorekisteri-service/henkilo/current/asiointiKieli`,
lokalisaatioUrl: `${DOMAIN}/lokalisointi/cxf/rest/v1/localisation?category=valintojen-toteuttaminen&locale=`,
Expand All @@ -34,6 +36,7 @@ export const configuration = {
ataruEditoriLogin: `${DOMAIN}/lomake-editori/auth/cas`,
valintalaskentaServiceLogin: `${DOMAIN}/valintalaskenta-laskenta-service/auth/login`,
valintalaskentaKoostePalveluUrl: `${DOMAIN}/valintalaskentakoostepalvelu/resources/`,
valintalaskentaServiceUrl: `${DOMAIN}/valintalaskenta-laskenta-service/resources/`,
koostetutPistetiedot: ({
hakuOid,
hakukohdeOid,
Expand Down
6 changes: 3 additions & 3 deletions src/app/lib/valintalaskentakoostepalvelu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const kaynnistaLaskenta = async (
): Promise<LaskentaStart> => {
const laskentaUrl = formSearchParamsForStartLaskenta({
laskentaUrl: new URL(
`${configuration.valintalaskentaKoostePalveluUrl}valintalaskentakerralla/haku/${haku.oid}/tyyppi/HAKUKOHDE/whitelist/true?`,
`${configuration.valintalaskentaServiceUrl}valintalaskentakerralla/haku/${haku.oid}/tyyppi/HAKUKOHDE/whitelist/true?`,
),
haku,
hakukohde,
Expand All @@ -114,7 +114,7 @@ export const kaynnistaLaskentaHakukohteenValinnanvaiheille = async (
): Promise<LaskentaStart> => {
const laskentaUrl = formSearchParamsForStartLaskenta({
laskentaUrl: new URL(
`${configuration.valintalaskentaKoostePalveluUrl}valintalaskentakerralla/haku/${haku.oid}/tyyppi/HAKUKOHDE/whitelist/true?`,
`${configuration.valintalaskentaServiceUrl}valintalaskentakerralla/haku/${haku.oid}/tyyppi/HAKUKOHDE/whitelist/true?`,
),
haku,
hakukohde,
Expand All @@ -140,7 +140,7 @@ export const getLaskennanTilaHakukohteelle = async (
ilmoitukset: [{ otsikko: string; tyyppi: string }] | null;
}>;
}>(
`${configuration.valintalaskentaKoostePalveluUrl}valintalaskentakerralla/status/${loadingUrl}/yhteenveto`,
`${configuration.valintalaskentaServiceUrl}valintalaskentakerralla/status/${loadingUrl}/yhteenveto`,
);
return response.data?.hakukohteet
?.filter((hk) => hk.ilmoitukset?.some((i) => i.tyyppi === 'VIRHE'))
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/valinnan-hallinta.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('displays valinnanvaiheet', async ({ page }) => {

test('starts laskenta', async ({ page }) => {
await page.route(
'*/**/valintalaskentakoostepalvelu/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
'*/**/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
async (route) => {
const started = {
lisatiedot: {
Expand Down Expand Up @@ -70,7 +70,7 @@ test('starts laskenta', async ({ page }) => {

test('shows success toast when laskenta completes', async ({ page }) => {
await page.route(
'*/**/valintalaskentakoostepalvelu/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
'*/**/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
async (route) => {
const started = {
lisatiedot: {
Expand Down Expand Up @@ -98,7 +98,7 @@ test('shows success toast when laskenta completes', async ({ page }) => {
},
);
await page.route(
'*/**/valintalaskentakoostepalvelu/resources/valintalaskentakerralla/status/12345abs/yhteenveto',
'*/**/resources/valintalaskentakerralla/status/12345abs/yhteenveto',
async (route) => {
await route.fulfill({
json: {
Expand All @@ -124,7 +124,7 @@ test('shows success toast when laskenta completes', async ({ page }) => {

test('starting laskenta causes error', async ({ page }) => {
await page.route(
'*/**/valintalaskentakoostepalvelu/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
'*/**/resources/valintalaskentakerralla/haku/1.2.246.562.29.00000000000000045102/tyyppi/HAKUKOHDE/whitelist/true**',
async (route) => {
await route.fulfill({ status: 500, body: 'Unknown error' });
},
Expand Down

0 comments on commit b4186e2

Please sign in to comment.