Skip to content

Commit

Permalink
Merge branch 'main' into feat/move-and-improve-e2e-tests-web
Browse files Browse the repository at this point in the history
  • Loading branch information
Svana committed Nov 21, 2024
2 parents 0783e04 + 6028a61 commit 50b5a4d
Show file tree
Hide file tree
Showing 28 changed files with 105 additions and 239 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Run on whenever you check out a branch:

```bash
yarn install
yarn infra install
(cd infra/ && yarn install)
yarn codegen
```

Expand Down
39 changes: 8 additions & 31 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CLI Tool Documentation
# Infra Tool Documentation

This CLI tool simplifies the management and setup of local environments for development. It provides commands to render environment variables, secrets, and URLs that are essential for configuring services during development.

Expand All @@ -8,35 +8,12 @@ This CLI tool simplifies the management and setup of local environments for deve
- **Ingress URL Management**: Generate and render ingress URLs for your services.
- **Service Configuration**: Ensure all necessary secrets and environment variables are loaded to correctly configure services.

### Available Commands

While the CLI offers various commands, one of the most powerful and useful for developers is the `run-local-env` command. This command allows developers to render the required environment and start a local development environment with the necessary configuration.

Here is a summary of all available commands in the CLI:

```text
yarn cli <command>
Commands:
yarn cli render-env Render a chart for environment
yarn cli render-urls Render urls from ingress for environment
yarn cli render-secrets Render secrets secrets needed by service
yarn cli render-env-vars Render environment variables needed by service.
This is to be used when developing locally and
loading of the environment variables for "dev"
environment is needed.
yarn cli render-local-env Render environment variables needed by service.
This is to be used when developing locally and
loading of the environment variables for "dev"
environment is needed.
yarn cli run-local-env Render environment and run the local environment.
This is to be used when developing locally and
loading of the environment variables for "dev"
environment is needed.
Options:
--help Show help [boolean]
--version Show version number [boolean]
## Available Commands

For a full list of available commands and options, run:

```bash
yarn infra --help
```

### `run-local-env` Command
Expand All @@ -46,7 +23,7 @@ The `run-local-env` command is a key tool for developers working in local enviro
#### Example Usage

```bash
yarn cli run-local-env <services> [options]
yarn infra run-local-env <services> [options]
```

This command automates the configuration setup, ensuring that the correct environment variables and dependencies are loaded for your local development environment.
Expand Down
3 changes: 2 additions & 1 deletion infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"charts": "node -r esbuild-register src/cli/generate-chart-values.ts",
"update": "yarn update:packagejson",
"update:packagejson": "node -r esbuild-register scripts/update-package-json.ts",
"cli": "node -r esbuild-register src/cli/cli.ts"
"cli": "echo 'Please use `yarn infra` instead of `yarn cli`' && exit 1",
"infra": "node -r esbuild-register src/cli/cli.ts"
},
"license": "MIT",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion infra/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { renderServiceEnvVars } from './render-env-vars'
import { renderLocalServices, runLocalServices } from './render-local-mocks'

const cli = yargs(process.argv.slice(2))
.scriptName('yarn cli')
.scriptName('yarn infra')
.command(
'render-env',
'Render a chart for environment',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService {
async addReview({
application,
auth,
}: TemplateApiModuleActionProps): Promise<void> {
}: TemplateApiModuleActionProps): Promise<Array<EmailRecipient>> {
const answers = application.answers as TransferOfVehicleOwnershipAnswers

// 1. Make sure review comes from buyer, he is the only one that can add more reviewers
Expand All @@ -342,7 +342,7 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService {
!answers.buyer.nationalId ||
auth.nationalId !== answers.buyer.nationalId
) {
return
return []
}

// 2. Notify users that were added that need to review
Expand All @@ -365,10 +365,11 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService {
)
if (buyerCoOwners) {
for (let i = 0; i < buyerCoOwners.length; i++) {
const oldEntry = oldRecipientList.find((x) => {
x.role === EmailRole.buyerCoOwner &&
x.ssn === buyerCoOwners[i].nationalId
})
const oldEntry = oldRecipientList.find(
(x) =>
x.role === EmailRole.buyerCoOwner &&
x.ssn === buyerCoOwners[i].nationalId,
)
const emailChanged = oldEntry
? oldEntry.email !== buyerCoOwners[i].email
: true
Expand All @@ -393,10 +394,11 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService {
)
if (buyerOperators) {
for (let i = 0; i < buyerOperators.length; i++) {
const oldEntry = oldRecipientList.find((x) => {
x.role === EmailRole.buyerOperator &&
x.ssn === buyerOperators[i].nationalId
})
const oldEntry = oldRecipientList.find(
(x) =>
x.role === EmailRole.buyerOperator &&
x.ssn === buyerOperators[i].nationalId,
)
const emailChanged = oldEntry
? oldEntry.email !== buyerOperators[i].email
: true
Expand Down Expand Up @@ -453,6 +455,8 @@ export class TransferOfVehicleOwnershipService extends BaseTemplateApiService {
})
}
}

return newlyAddedRecipientList
}

async rejectApplication(props: TemplateApiModuleActionProps): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ export const payment = {
},
}),
paymentChargeOverview: defineMessages({
forPayment: {
id: 'aosh.tmo.application:payment.paymentChargeOverview.forPayment',
defaultMessage: 'Til greiðslu',
description: 'For payment label',
},
total: {
id: 'aosh.tmo.application:payment.paymentChargeOverview.total',
defaultMessage: 'Samtals',
description: 'Total amount label',
},
alertTitle: {
id: 'aosh.tmo.application:payment.paymentChargeOverview.alertTitle',
defaultMessage: 'Til athugunar!',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ export const payment = {
description: 'Payment page title',
},
}),
paymentChargeOverview: defineMessages({
forPayment: {
id: 'doi.cs.application:payment.paymentChargeOverview.forPayment',
defaultMessage: 'Til greiðslu',
description: 'For payment label',
},
total: {
id: 'doi.cs.application:payment.paymentChargeOverview.total',
defaultMessage: 'Samtals',
description: 'Total amount label',
},
}),
confirmation: defineMessages({
confirm: {
id: 'doi.cs.application:payment.confirmation.confirm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ export const payment = {
description: 'Payment page title',
},
}),
paymentChargeOverview: defineMessages({
forPayment: {
id: 'hlc.application:payment.paymentChargeOverview.forPayment',
defaultMessage: 'Til greiðslu',
description: 'For payment label',
},
total: {
id: 'hlc.application:payment.paymentChargeOverview.total',
defaultMessage: 'Samtals',
description: 'Total amount label',
},
}),
confirmation: defineMessages({
confirm: {
id: 'hlc.application:payment.confirmation.confirm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@ export const payment = {
description: 'Payment page title',
},
}),
paymentChargeOverview: defineMessages({
forPayment: {
id: 'hwp.application:payment.paymentChargeOverview.forPayment',
defaultMessage: 'Til greiðslu',
description: 'For payment label',
},
total: {
id: 'hwp.application:payment.paymentChargeOverview.total',
defaultMessage: 'Samtals',
description: 'Total amount label',
},
}),

confirmation: defineMessages({
confirm: {
id: 'hwp.application:payment.confirmation.confirm',
Expand Down
12 changes: 0 additions & 12 deletions libs/application/templates/id-card/src/lib/messages/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ export const payment = {
description: 'Payment page title',
},
}),
paymentChargeOverview: defineMessages({
forPayment: {
id: 'id.application:payment.paymentChargeOverview.forPayment',
defaultMessage: 'Til greiðslu',
description: 'For payment label',
},
total: {
id: 'id.application:payment.paymentChargeOverview.total',
defaultMessage: 'Samtals',
description: 'Total amount label',
},
}),
confirmation: defineMessages({
confirm: {
id: 'id.application:payment.confirmation.confirm',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
InstitutionNationalIds,
MockablePaymentCatalogApi,
PaymentCatalogApi,
} from '@island.is/application/types'

Expand All @@ -11,3 +12,11 @@ export const SyslumadurPaymentCatalogApi = PaymentCatalogApi.configure({
},
externalDataId: 'payment',
})

export const MockableSyslumadurPaymentCatalogApi =
MockablePaymentCatalogApi.configure({
params: {
organizationId: InstitutionNationalIds.SYSLUMENN,
},
externalDataId: 'payment',
})
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
confirmation,
externalData,
overview,
payment,
property,
propertySearch,
} from '../lib/messages'
Expand Down Expand Up @@ -83,8 +82,6 @@ export const MortgageCertificateForm = (
],
}),
buildFormPaymentChargeOverviewSection({
sectionTitle: payment.general.sectionTitle,
forPaymentLabel: payment.labels.forPayment,
getSelectedChargeItems: (application) =>
getChargeItemCodesAndExtraLabel(application),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
IdentityApi,
UserProfileApi,
SyslumadurPaymentCatalogApi,
MockableSyslumadurPaymentCatalogApi,
} from '../dataProviders'
import { confirmation, externalData, payment, property } from '../lib/messages'
import Logo from '../assets/Logo'
Expand Down Expand Up @@ -60,6 +61,10 @@ export const PrerequisitesForm: Form = buildForm({
provider: SyslumadurPaymentCatalogApi,
title: '',
}),
buildDataProviderItem({
provider: MockableSyslumadurPaymentCatalogApi,
title: '',
}),
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,4 @@ export const payment = {
description: 'Payment section title',
},
}),
labels: defineMessages({
forPayment: {
id: 'mc.application:payment.labels.forPayment',
defaultMessage: 'Til greiðslu',
description: 'Payment for payment label',
},
}),
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
IdentityApi,
UserProfileApi,
SyslumadurPaymentCatalogApi,
MockableSyslumadurPaymentCatalogApi,
} from '../dataProviders'
import { AuthDelegationType } from '@island.is/shared/types'
import { buildPaymentState } from '@island.is/application/utils'
Expand Down Expand Up @@ -84,7 +85,12 @@ const template: ApplicationTemplate<
write: 'all',
read: 'all',
delete: true,
api: [IdentityApi, UserProfileApi, SyslumadurPaymentCatalogApi],
api: [
IdentityApi,
UserProfileApi,
SyslumadurPaymentCatalogApi,
MockableSyslumadurPaymentCatalogApi,
],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1429,11 +1429,17 @@ export const calculateEndDateForPeriodWithStartAndLength = (
let endDate = addDays(lastMonthBeforeEndDate, daysToAdd - 1)
const daysInMonth = getDaysInMonth(lastMonthBeforeEndDate)

// If startDay is first day of the month and daysToAdd = 0
if (daysToAdd === 0) {
if (start.getDate() === 31) {
endDate = addDays(endDate, 1)
}
if (
start.getDate() > 28 &&
daysInMonth === 28 &&
endDate.getDate() !== 28
) {
endDate = addDays(endDate, 1)
}
return endDate
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,16 @@ export const VehicleSelectField: FC<
const disabled =
!!response?.vehiclePlateOrderChecksByPermno?.validationErrorMessages
?.length
setPlate(disabled ? '' : currentVehicle.permno || '')
setValue(
'pickVehicle.plate',
disabled ? '' : currentVehicle.permno || '',
)

const permno = disabled ? '' : currentVehicle.permno || ''

setPlate(permno)

setValue('pickVehicle.plate', permno)

setValue('plateSize.frontPlateSize', [])
setValue('plateSize.rearPlateSize', [])

setIsLoading(false)
})
.catch((error) => console.error(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ export const OrderVehicleLicensePlateSchema = z.object({
plate: z.string(),
type: z.string(),
}),
plateSize: z.object({
frontPlateSize: z.array(z.string()),
rearPlateSize: z.array(z.string()),
}),
plateSize: z
.object({
frontPlateSize: z.array(z.string()),
rearPlateSize: z.array(z.string()),
})
.refine(({ frontPlateSize, rearPlateSize }) => {
return frontPlateSize.length !== 0 || rearPlateSize.length !== 0
}),
plateDelivery: z.object({
deliveryMethodIsDeliveryStation: z.enum([YES, NO]),
deliveryStationTypeCode: z.string().optional(),
Expand Down
Loading

0 comments on commit 50b5a4d

Please sign in to comment.