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

fix(appliaction-estate): Catch if preregistered heirs are foreign citizens #16362

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

juni-haukur
Copy link
Member

@juni-haukur juni-haukur commented Oct 10, 2024

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features
    • Enhanced type safety by updating property types to use imported constants for noContactInfo, foreignCitizenship, and knowledgeOfOtherWills.
    • Added new property foreignCitizenship to the EstateMember type.
  • Bug Fixes
    • Updated logic for determining foreign citizenship to use constants instead of strings, improving clarity and consistency.
  • Chores
    • Consolidated constant imports to a centralized source, enhancing maintainability across the application.

@juni-haukur juni-haukur requested review from a team as code owners October 10, 2024 16:07
Copy link
Contributor

coderabbitai bot commented Oct 10, 2024

Walkthrough

The pull request involves significant modifications across various files in the estate template module. Key changes include the removal of the YES and NO constants from local definitions and their replacement with imports from @island.is/application/core. This affects type definitions, component logic, and validation schemas, enhancing type safety and consistency. Additionally, several components have been updated to reflect these changes, particularly in how they handle foreign citizenship and estate member information.

Changes

File Change Summary
libs/application/template-api-modules/src/lib/modules/templates/estate/consts.ts Removed constants YES and NO.
libs/application/template-api-modules/src/lib/modules/templates/estate/types/index.ts Updated noContactInfo type to use imported YES and NO constants.
libs/application/template-api-modules/src/lib/modules/templates/estate/utils/fakeData.ts Changed value of knowledgeOfOtherWills from 'Yes' to YES constant.
libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts Updated noContactInfo initialization to use NO constant; added foreignCitizenship property.
libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx Updated import for YES; modified conditional rendering for foreign citizenship fields.
libs/application/templates/estate/src/fields/EstateMembersRepeater/index.tsx Added DatePickerController import; updated logic for foreign citizenship.
libs/application/templates/estate/src/forms/OverviewSections/commonFields.ts Updated import for YES; removed local import.
libs/application/templates/estate/src/forms/OverviewSections/confirmAction.ts Updated import for YES; removed local import.
libs/application/templates/estate/src/forms/Overviews.ts Updated imports for YES and NO; removed local imports.
libs/application/templates/estate/src/forms/Sections/announcerInfo.ts Updated imports for YES and NO; removed local import.
libs/application/templates/estate/src/forms/Sections/approveSubmission.ts Updated import for YES; removed local import.
libs/application/templates/estate/src/forms/Sections/estateAssets.ts Updated import for YES; removed local import.
libs/application/templates/estate/src/forms/Sections/estateDebts.ts Updated import for YES; removed local import.
libs/application/templates/estate/src/forms/Sections/estateWithoutAssets.ts Added YES and NO imports; updated radio field options.
libs/application/templates/estate/src/forms/Sections/spouseOfTheDeceased.ts Added YES and NO imports; updated radio field options.
libs/application/templates/estate/src/forms/Sections/testamentInfo.ts Added YES and NO imports; updated radio field options.
libs/application/templates/estate/src/lib/constants.ts Removed constants YES and NO.
libs/application/templates/estate/src/lib/dataSchema.ts Updated import for YES and NO; modified validation logic.
libs/application/templates/estate/src/types.ts Updated types to use imported YES and NO constants.
libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx Added YES import; updated logic for foreign citizenship.
libs/clients/syslumenn/src/lib/syslumennClient.types.ts Updated noContactInfo and knowledgeOfOtherWills types to lowercase literals.
libs/clients/syslumenn/src/lib/syslumennClient.utils.ts Added foreignCitizenship logic; updated return values for consistency.

Possibly related PRs

Suggested labels

automerge, high priority

Suggested reviewers

  • sigruntg
  • albinagu

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 52b8ff5 and 8eafc5b.

📒 Files selected for processing (3)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/fakeData.ts (3 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts (3 hunks)
  • libs/clients/syslumenn/src/lib/syslumennClient.utils.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/fakeData.ts
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts
  • libs/clients/syslumenn/src/lib/syslumennClient.utils.ts

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@juni-haukur juni-haukur changed the title fix(appliaction-estate): Catch if preregister eheirs are foreign citizens fix(appliaction-estate): Catch if preregistered heirs are foreign citizens Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 36.74%. Comparing base (eebf2ef) to head (8eafc5b).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
.../estate/src/fields/EstateMembersRepeater/index.tsx 0.00% 9 Missing ⚠️
...application/templates/estate/src/lib/dataSchema.ts 0.00% 4 Missing ⚠️
.../src/lib/modules/templates/estate/utils/mappers.ts 66.66% 1 Missing ⚠️
...eritance-report/src/fields/HeirsRepeater/index.tsx 0.00% 1 Missing ⚠️
...clients/syslumenn/src/lib/syslumennClient.utils.ts 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16362   +/-   ##
=======================================
  Coverage   36.73%   36.74%           
=======================================
  Files        6804     6804           
  Lines      140860   140906   +46     
  Branches    40117    40130   +13     
=======================================
+ Hits        51751    51779   +28     
- Misses      89109    89127   +18     
Flag Coverage Δ
api 3.37% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-mortgage-certificate 34.92% <0.00%> (ø)
application-api-files 57.97% <ø> (ø)
application-system-api 41.44% <50.00%> (-0.01%) ⬇️
application-template-api-modules 27.97% <0.00%> (+0.01%) ⬆️
application-templates-estate 12.27% <0.00%> (-0.04%) ⬇️
application-templates-inheritance-report 6.43% <0.00%> (ø)
application-ui-shell 21.27% <ø> (ø)
clients-syslumenn 49.42% <50.00%> (ø)
services-auth-admin-api 51.84% <0.00%> (ø)
services-auth-delegation-api 57.32% <0.00%> (ø)
services-auth-ids-api 51.43% <0.00%> (+0.01%) ⬆️
services-auth-personal-representative 45.13% <0.00%> (-0.03%) ⬇️
services-auth-personal-representative-public 41.31% <0.00%> (+0.08%) ⬆️
services-auth-public-api 48.91% <0.00%> (ø)
services-user-notification 47.15% <ø> (+0.13%) ⬆️
services-user-profile 62.17% <ø> (ø)
web 1.83% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...modules/src/lib/modules/templates/estate/consts.ts 100.00% <ø> (ø)
...src/lib/modules/templates/estate/utils/fakeData.ts 13.63% <100.00%> (+4.11%) ⬆️
...s/EstateMembersRepeater/AdditionalEstateMember.tsx 0.00% <ø> (ø)
.../estate/src/forms/OverviewSections/commonFields.ts 0.00% <ø> (ø)
...estate/src/forms/OverviewSections/confirmAction.ts 0.00% <ø> (ø)
...pplication/templates/estate/src/forms/Overviews.ts 0.00% <ø> (ø)
...mplates/estate/src/forms/Sections/announcerInfo.ts 0.00% <ø> (ø)
...tes/estate/src/forms/Sections/approveSubmission.ts 0.00% <ø> (ø)
...emplates/estate/src/forms/Sections/estateAssets.ts 0.00% <ø> (ø)
...templates/estate/src/forms/Sections/estateDebts.ts 0.00% <ø> (ø)
... and 10 more

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eebf2ef...8eafc5b. Read the comment docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (26)
libs/application/templates/estate/src/forms/Sections/approveSubmission.ts (1)

Line range hint 9-41: Consider enhancing type safety with explicit type annotations

The code structure looks good and follows our guidelines for TypeScript usage and reusability. To further improve type safety, consider adding explicit type annotations to the buildSection and buildMultiField function calls. This would make the code more robust and self-documenting.

For example:

export const approvePrivateDivisionSubmission = buildSection<YourFormType>({
  // ... existing code
})

Replace YourFormType with the appropriate type for your form structure.

libs/application/templates/estate/src/forms/Sections/estateWithoutAssets.ts (3)

7-8: Approve changes in import statements with a minor suggestion.

The changes improve consistency by using core constants for boolean values and local constants for language-specific terms. This aligns well with effective tree-shaking and bundling practices.

Consider combining the imports from @island.is/application/core into a single line for better readability:

import { buildDescriptionField, buildSection, buildMultiField, buildRadioField, getValueViaPath, YES, NO } from '@island.is/application/core'

Also applies to: 11-11


Line range hint 28-31: Approve changes in radio field options with a suggestion for improved type safety.

The changes improve type safety and internationalization support by using consistent boolean constants for values and language-specific constants for labels. This aligns well with TypeScript usage guidelines for defining props.

To further enhance type safety, consider defining a type for the radio options:

type RadioOption = {
  label: string;
  value: typeof YES | typeof NO;
};

const options: RadioOption[] = [
  { label: JA, value: YES },
  { label: NEI, value: NO },
];

Then use this type in the buildRadioField function:

buildRadioField<RadioOption>({
  // ... other props
  options: options,
});

This will ensure that all radio fields consistently use the correct option structure.

Also applies to: 39-42


Line range hint 1-68: Overall assessment: Improvements in consistency and type safety.

The changes in this file align well with the coding guidelines for the libs/**/* path pattern. The modifications enhance reusability, improve type safety, and support effective tree-shaking. The use of core constants and local language-specific constants improves consistency and internationalization support.

To further improve the module's architecture:

  1. Consider creating a dedicated types file for commonly used types like radio options.
  2. Evaluate if other parts of the estate template could benefit from similar consistency improvements.
  3. Document the usage of core constants vs. local constants to guide future development.
libs/application/templates/estate/src/forms/Sections/spouseOfTheDeceased.ts (1)

Line range hint 38-39: Ensure consistency between labels and values in radio options

The values for the radio options have been updated to use the new YES and NO constants, which is good. However, the labels still use JA and NEI. This inconsistency might lead to confusion.

Consider updating the labels to match the values for better consistency:

options: [
  { label: YES, value: YES },
  { label: NO, value: NO },
],

If JA and NEI are specific Icelandic terms that need to be retained, please add a comment explaining this choice for clarity.

libs/application/templates/estate/src/types.ts (1)

53-53: LGTM: Enhanced type safety and consistency

The update to use typeof YES | typeof NO for the knowledgeOfOtherWills property improves type safety and consistency. This change aligns well with our TypeScript usage guidelines.

Consider using a more descriptive type alias for better readability:

type YesNo = typeof YES | typeof NO;

// Then use it in the Answers type
knowledgeOfOtherWills: YesNo;

This would improve code readability and make it easier to reuse this type combination elsewhere if needed.

libs/application/templates/estate/src/forms/OverviewSections/confirmAction.ts (2)

1-7: Approved: Import change improves consistency

The change to import YES from @island.is/application/core instead of local constants is a good improvement. It enhances consistency and aligns with the guideline of reusability across different NextJS apps.

Consider moving EstateTypes to @island.is/application/core as well if it's used across multiple components or applications. This would further improve consistency and reusability.


Line range hint 9-89: LGTM: Consistent usage of YES constant

The usage of the YES constant throughout the file is consistent and maintains the existing functionality. The code structure allows for effective tree-shaking and bundling, which is good for performance.

To improve readability, consider extracting the complex conditions in the buildCheckboxField calls into separate functions. For example:

const isEstateWithoutAssets = (answers) => 
  getValueViaPath(answers, 'selectedEstate') === EstateTypes.estateWithoutAssets;

const hasAssetsAndDebt = (answers) => {
  const hasAssets = getValueViaPath(answers, 'estateWithoutAssets.estateAssetsExist') === YES;
  const hasDebt = getValueViaPath(answers, 'estateWithoutAssets.estateDebtsExist') === YES;
  return hasAssets && hasDebt;
};

// Use these functions in the condition fields
condition: isEstateWithoutAssets,
// ...
condition: (answers) => isEstateWithoutAssets(answers) && hasAssetsAndDebt(answers),

This would make the code more readable and easier to maintain.

libs/application/template-api-modules/src/lib/modules/templates/estate/types/index.ts (1)

40-40: Approved: Type modification enhances type safety.

The update to noContactInfo property type improves type safety and ensures consistency with the core module's definitions. This change aligns well with TypeScript best practices.

Consider adding a comment explaining the purpose of the noContactInfo property for better code documentation. For example:

/** Indicates whether contact information is available for the estate member */
noContactInfo?: (typeof YES | typeof NO)[]
libs/application/templates/estate/src/forms/OverviewSections/commonFields.ts (1)

7-7: Approve import changes with a suggestion for improvement

The import changes improve consistency by using the YES constant from the core module. This aligns with the coding guidelines for libs/** files, promoting reusability across different NextJS apps.

However, the addition of JA and NEI imports might be redundant if they're used to replace the previous YES constant. Consider using the YES and NO constants from '@island.is/application/core' throughout the file for better consistency.

Consider replacing JA and NEI with YES and NO from '@island.is/application/core' respectively:

-import { JA, NEI } from '../../lib/constants'
+import { YES, NO } from '@island.is/application/core'

Then update their usage throughout the file.

Also applies to: 15-15

libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (2)

10-13: Improve consistency in constant usage

The changes to import YES and NO from @island.is/application/core improve reusability and consistency across the application. This aligns well with our coding guidelines for libs.

However, we're still using local constants JA and NEI. Consider replacing these with the imported YES and NO for better consistency and maintainability.

Consider updating the usage of JA and NEI throughout the file to use the imported YES and NO constants. This will further improve consistency and make the code more maintainable.


Line range hint 134-139: Approve changes to buildRadioField with minor suggestion

The use of imported YES and NO constants for values in the buildRadioField component improves consistency with the core application. This change aligns well with our coding guidelines for reusability and type safety.

Consider adding a comment explaining why JA and NEI are used for labels while YES and NO are used for values. This will help future maintainers understand the reasoning behind using different constants for labels and values.

libs/application/templates/estate/src/forms/Overviews.ts (1)

8-9: Improved import consistency, consider further optimization.

The changes to import YES and NO from @island.is/application/core improve consistency and align with the guideline for reusability across different NextJS apps. This is a positive change.

Consider evaluating if EstateTypes could also be moved to a shared location, potentially improving reusability further. If EstateTypes is specific to this module, please add a comment explaining why it's kept local.

Also applies to: 17-17

libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts (1)

Line range hint 34-48: LGTM: Improved type safety and handling of foreign citizenship.

The changes in the estateMemberMapper function enhance type safety and consistency:

  1. Using [NO] instead of ['No'] for noContactInfo improves type checking.
  2. The new foreignCitizenship property handles cases where nationalId is missing or ends with '0000'.

These updates align with the coding guidelines for TypeScript usage and type safety.

Consider extracting the foreignCitizenship logic into a separate function for better readability:

const determineForeignCitizenship = (nationalId: string | undefined): (typeof YES | typeof NO)[] =>
  !nationalId || nationalId.endsWith('0000') ? [YES] : [NO];

// Usage in estateMemberMapper
foreignCitizenship: element.foreignCitizenship ?? determineForeignCitizenship(element.nationalId),
libs/clients/syslumenn/src/lib/syslumennClient.types.ts (3)

226-232: LGTM! Consider using a shared type for consistency.

The changes to EstateMember type look good. The noContactInfo property now uses lowercase values, which improves consistency. The addition of foreignCitizenship aligns with the PR objective of handling foreign citizens.

To further improve consistency and maintainability, consider creating a shared type for the ('yes' | 'no')[] pattern:

type YesNo = 'yes' | 'no';

export type EstateMember = {
  // ... other properties
  noContactInfo?: YesNo[];
  foreignCitizenship?: YesNo[];
}

This approach would make it easier to update the type if needed in the future and ensure consistency across the codebase.


282-282: LGTM! Consider using the shared type for consistency.

The change to the knowledgeOfOtherWills property in the EstateCommon interface looks good. It now uses lowercase values, which improves consistency with the EstateMember type.

To maintain consistency with the earlier suggestion, consider using the shared YesNo type here as well:

type YesNo = 'yes' | 'no';

interface EstateCommon {
  // ... other properties
  knowledgeOfOtherWills: YesNo;
}

This approach ensures consistency across the entire file and makes future updates easier.


Line range hint 1-450: Overall, the changes improve consistency and align with PR objectives.

The modifications to EstateMember and EstateCommon types enhance consistency by using lowercase values for boolean-like string literals. The addition of the foreignCitizenship property addresses the PR objective of handling foreign citizens.

These changes adhere to the coding guidelines for libs/**/* files:

  • They define reusable types that can be used across different NextJS apps.
  • They use TypeScript for defining and exporting types.
  • The changes don't negatively impact tree-shaking or bundling practices.

To further improve the type definitions:

  1. Consider creating a shared YesNo type for the 'yes' | 'no' pattern.
  2. Evaluate if other properties in this file could benefit from similar consistency improvements.
  3. Document the purpose of the new foreignCitizenship property to provide context for its addition.

These enhancements will contribute to better maintainability and clarity of the codebase.

libs/application/templates/estate/src/forms/Sections/estateAssets.ts (1)

9-12: Approved: Improved import consistency, with a suggestion for further enhancement.

The change to import YES from @island.is/application/core improves consistency and aligns with the coding guideline for reusability across different NextJS apps. This is a positive change.

Consider also moving EstateTypes to the core library if it's used across multiple templates or applications. This would further enhance reusability and consistency.

libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx (3)

Line range hint 65-68: Improved type safety in useWatch hook

The use of hasYes(field.foreignCitizenship) in the useWatch hook enhances type safety and aligns with our TypeScript usage guidelines. This change improves the handling of the foreignCitizenship field.

For even better clarity, consider using a constant for the empty string default value:

const DEFAULT_FOREIGN_CITIZENSHIP = '';
// ...
defaultValue: hasYes(field.foreignCitizenship) ? [YES] : DEFAULT_FOREIGN_CITIZENSHIP,

This would make the intent clearer and easier to maintain.


Line range hint 125-157: Improved conditional rendering and form validation

The changes in the conditional rendering logic and the addition of the required prop to the DatePickerController are good improvements:

  1. The explicit check foreignCitizenship?.[0] === YES enhances code clarity and type safety.
  2. Making the date of birth field required for foreign citizens is a logical improvement.

To maintain consistency across the component, consider extracting the condition into a constant:

const isForeignCitizen = foreignCitizenship?.[0] === YES;

// Then use it in the conditional rendering
{isForeignCitizen ? (
  // ... existing code for foreign citizens
) : (
  // ... existing code for non-foreign citizens
)}

This would make the code more readable and easier to maintain, especially if this condition is used in multiple places within the component.


Line range hint 289-301: Consistent use of core constants in CheckboxController

The use of the YES constant from the core package in the CheckboxController for foreign citizenship is a good change. It aligns with the earlier import modifications and improves consistency across the application.

To further improve code organization and reusability, consider extracting the checkbox option into a constant:

const FOREIGN_CITIZENSHIP_OPTION = {
  label: formatMessage(m.inheritanceForeignCitizenshipLabel),
  value: YES,
};

// Then use it in the CheckboxController
<CheckboxController
  // ... other props
  options={[FOREIGN_CITIZENSHIP_OPTION]}
  // ... rest of the component
/>

This approach would enhance maintainability and make it easier to reuse this option if needed elsewhere in the component or in other components.

libs/application/templates/estate/src/lib/dataSchema.ts (1)

Line range hint 124-130: LGTM: Improved handling of foreign citizenship for nationalId validation.

The refinement now correctly checks if foreignCitizenship[0] === NO before validating the nationalId, which aligns with the PR objective to handle preregistered heirs who are foreign citizens.

Consider adding a comment explaining the logic behind this condition for better maintainability.

 .refine(
   ({ foreignCitizenship, nationalId, enabled }) => {
+    // Only validate nationalId for non-foreign citizens
     return enabled && foreignCitizenship?.[0] === NO
       ? nationalId && kennitala.isValid(nationalId)
       : true
   },
   {
     path: ['nationalId'],
   },
 )
libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx (3)

Line range hint 65-76: Improved age validation logic, but consider refactoring for readability

The updated logic for checking if an estate member is under 18 now correctly handles both foreign and domestic citizens. The use of intervalToDuration for age calculation of foreign citizens is more accurate. However, the complexity of this logic might make it harder to maintain in the future.

Consider refactoring this part into a separate function for improved readability and maintainability. For example:

const isUnder18 = (member: EstateMember): boolean => {
  const hasForeignCitizenship = member?.foreignCitizenship?.[0] === YES;
  const birthDate = member?.dateOfBirth;
  const memberAge = hasForeignCitizenship && birthDate
    ? intervalToDuration({ start: new Date(birthDate), end: new Date() })?.years
    : info(member.nationalId)?.age;
  return (memberAge ?? 0) < 18 && (member?.nationalId || birthDate) && member.enabled;
};

Then you can use this function in your component:

const hasEstateMemberUnder18 = values.estate?.estateMembers?.some(isUnder18);

Line range hint 210-275: Improved flexibility for handling different application types, but function complexity is high

The updateValues function has been successfully modified to handle both regular and pre-paid inheritance applications. The logic for calculating inheritance values and taxes has been updated accordingly, which improves the overall functionality of the component.

However, the function has become quite long and complex. To improve maintainability and testability, consider splitting this function into smaller, more focused functions. For example:

  1. A function to determine if the heir is a spouse
  2. A function to calculate inheritance values
  3. A function to calculate taxes

This refactoring would make the code easier to understand, maintain, and test. It would also align better with the SOLID principles, particularly the Single Responsibility Principle.


Line range hint 441-495: Improved custom field rendering, but error handling could be optimized

The updated rendering logic for custom fields enhances the component's flexibility, allowing it to handle different types of custom fields appropriately. The structure of the code, using early returns for different field types, improves readability compared to nested if-else statements.

However, the error handling logic is repeated across different field types. Consider extracting this logic into a separate function to reduce code duplication and improve maintainability. For example:

const getFieldError = (error: any, mainIndex: number, fieldId: string) => 
  error && error[mainIndex] ? error[mainIndex][fieldId] : undefined;

// Usage
error={getFieldError(error, mainIndex, customField.id)}

This change would align with the DRY (Don't Repeat Yourself) principle and make the code more maintainable.

libs/clients/syslumenn/src/lib/syslumennClient.utils.ts (1)

405-409: LGTM! Consider a minor improvement for clarity.

The addition of the foreignCitizenship property effectively addresses the PR objective to catch if preregistered heirs are foreign citizens. The logic is sound, assuming that a missing national ID or one ending with '0000' indicates foreign citizenship.

For improved clarity, consider using a boolean value instead of an array with 'yes' or 'no'. This would make the property more intuitive to use:

-    foreignCitizenship:
-      !estateRaw.kennitala || estateRaw.kennitala.endsWith('0000')
-        ? ['yes']
-        : ['no'],
+    isForeignCitizen:
+      !estateRaw.kennitala || estateRaw.kennitala.endsWith('0000'),

This change would make the property easier to use in conditional statements without needing to access an array element.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between eebf2ef and 8c19e29.

📒 Files selected for processing (22)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/consts.ts (0 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/types/index.ts (2 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/fakeData.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts (3 hunks)
  • libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx (3 hunks)
  • libs/application/templates/estate/src/fields/EstateMembersRepeater/index.tsx (3 hunks)
  • libs/application/templates/estate/src/forms/OverviewSections/commonFields.ts (1 hunks)
  • libs/application/templates/estate/src/forms/OverviewSections/confirmAction.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Overviews.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/approveSubmission.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/estateAssets.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/estateDebts.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/estateWithoutAssets.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/spouseOfTheDeceased.ts (1 hunks)
  • libs/application/templates/estate/src/forms/Sections/testamentInfo.ts (1 hunks)
  • libs/application/templates/estate/src/lib/constants.ts (0 hunks)
  • libs/application/templates/estate/src/lib/dataSchema.ts (5 hunks)
  • libs/application/templates/estate/src/types.ts (3 hunks)
  • libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx (2 hunks)
  • libs/clients/syslumenn/src/lib/syslumennClient.types.ts (2 hunks)
  • libs/clients/syslumenn/src/lib/syslumennClient.utils.ts (3 hunks)
💤 Files with no reviewable changes (2)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/consts.ts
  • libs/application/templates/estate/src/lib/constants.ts
✅ Files skipped from review due to trivial changes (1)
  • libs/application/template-api-modules/src/lib/modules/templates/estate/utils/fakeData.ts
🧰 Additional context used
📓 Path-based instructions (19)
libs/application/template-api-modules/src/lib/modules/templates/estate/types/index.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/fields/EstateMembersRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/OverviewSections/commonFields.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/OverviewSections/confirmAction.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Overviews.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/approveSubmission.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/estateAssets.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/estateDebts.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/estateWithoutAssets.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/spouseOfTheDeceased.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/testamentInfo.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/lib/dataSchema.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/types.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/clients/syslumenn/src/lib/syslumennClient.types.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/clients/syslumenn/src/lib/syslumennClient.utils.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 Biome
libs/application/templates/estate/src/fields/EstateMembersRepeater/index.tsx

[error] 245-245: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 262-262: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (23)
libs/application/templates/estate/src/forms/Sections/approveSubmission.ts (1)

Line range hint 1-7: Approved: Improved import for better reusability and consistency

The change to import YES from @island.is/application/core instead of a local constants file is a good improvement. This aligns with our coding guidelines for better reusability across different NextJS apps and may enhance tree-shaking and bundling practices.

libs/application/templates/estate/src/forms/Sections/spouseOfTheDeceased.ts (2)

Line range hint 52-56: Approve updates to condition checks

The condition checks have been correctly updated to use the new YES constant. This change maintains consistency with the imported constants while preserving the original logic.

Also applies to: 63-67


Line range hint 1-70: Overall improvements with minor adjustments needed

The changes in this file contribute to better reusability and consistency by using shared constants from the core module. The TypeScript usage for defining props and exporting types is maintained, adhering to our coding guidelines.

However, there are a few minor issues to address:

  1. The missing import for the JA constant.
  2. The inconsistency between labels and values in the radio options.

Once these are resolved, the changes will significantly improve the code quality and maintainability.

To ensure all usages of YES, NO, JA, and NEI are consistent throughout the codebase, please run the following script:

This will help identify any inconsistencies in constant usage across the estate template module.

libs/application/templates/estate/src/types.ts (1)

1-1: LGTM: Improved reusability and consistency

The addition of the import statement for YES and NO from @island.is/application/core enhances reusability across different NextJS apps and promotes consistency by using shared constants. This change also facilitates effective tree-shaking.

libs/application/templates/estate/src/forms/Sections/testamentInfo.ts (1)

8-9: Approve: Improved import management and constant usage

The changes to the import statements enhance code maintainability and consistency:

  1. Importing YES and NO from @island.is/application/core instead of a local constants file promotes reusability across different NextJS apps.
  2. This change ensures consistent usage of these constants throughout the application.
  3. The modification doesn't affect functionality, as the constants are used in the same way in the buildRadioField options.

These changes align well with our coding guidelines for libs, particularly in terms of reusability and effective bundling practices.

Also applies to: 12-12

libs/application/templates/estate/src/forms/Sections/estateDebts.ts (3)

Line range hint 1-9: LGTM: Import changes improve reusability

The modification to import YES from @island.is/application/core instead of local constants aligns with the coding guideline for reusability across different NextJS apps. This change promotes consistency and makes it easier to maintain shared constants.


Line range hint 11-26: Correct usage of imported YES constant

The YES constant, now imported from @island.is/application/core, is correctly used in the condition function. The logic remains unchanged, ensuring that the refactoring of the import doesn't affect the functionality of the code.


Line range hint 1-85: Code adheres to guidelines and best practices

The code in this file adheres to the coding guidelines for the libs/**/* pattern. It effectively uses TypeScript for defining props and exporting types, and the structure promotes good tree-shaking and bundling practices. The changes made improve reusability while maintaining the existing functionality.

libs/application/template-api-modules/src/lib/modules/templates/estate/types/index.ts (2)

1-1: LGTM: Import statement enhances reusability and consistency.

The import of NO and YES constants from the core module aligns with best practices for maintaining consistency across the application and enhances reusability.


Line range hint 1-40: Adherence to coding guidelines for libs/**/* files

The file successfully meets the following guidelines:

  1. Reusability: The type definitions can be easily reused across different NextJS apps.
  2. TypeScript usage: Props and types are effectively defined using TypeScript.

The guideline regarding effective tree-shaking and bundling practices is not directly applicable to this file as it only contains type definitions.

libs/application/templates/estate/src/forms/OverviewSections/commonFields.ts (1)

Line range hint 86-89: Improve consistency in constant usage and verify changes

The usage of YES for condition checking is correct. However, there's an inconsistency between using YES for checking and JA/NEI for display values. This mix of languages (English and Icelandic) could lead to confusion.

Consider using YES and NO consistently for both checking and display:

-value: ({ answers }) =>
-  getValueViaPath(answers, 'estate.testament.wills') === YES ? JA : NEI,
+value: ({ answers }) =>
+  getValueViaPath(answers, 'estate.testament.wills') === YES ? YES : NO,

Apply this change to both buildKeyValueField components in this segment.

Let's verify the impact of these changes across the codebase:

This script will help us understand the current usage patterns and ensure that our suggested changes are applied consistently across the estate template module.

Also applies to: 92-95

✅ Verification successful

</run_scripts>


Consistency Verified

The usage of YES for condition checks and JA/NEI for display values is consistent and appropriate within the codebase. JA and NEI serve as localized labels, while YES and NO handle conditional logic effectively.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of JA, NEI, YES, and NO constants

# Test 1: Check for JA and NEI usage
echo "Checking for JA and NEI usage:"
rg --type typescript "JA|NEI" libs/application/templates/estate/

# Test 2: Check for YES and NO usage from @island.is/application/core
echo "Checking for YES and NO usage from @island.is/application/core:"
rg --type typescript "import.*YES.*from '@island.is/application/core'" libs/application/templates/estate/
rg --type typescript "import.*NO.*from '@island.is/application/core'" libs/application/templates/estate/

# Test 3: Check for local constant definitions of YES and NO
echo "Checking for local constant definitions of YES and NO:"
rg --type typescript "const.*YES.*=|const.*NO.*=" libs/application/templates/estate/

Length of output: 847


Script:

#!/bin/bash
# Description: Check for usage of JA, NEI, YES, and NO constants in TypeScript files

# Test 1: Check for JA and NEI usage
echo "Checking for JA and NEI usage:"
rg "JA|NEI" libs/application/templates/estate/ -g '*.ts' -g '*.tsx'

# Test 2: Check for YES and NO usage from @island.is/application/core
echo "Checking for YES and NO usage from @island.is/application/core:"
rg "import.*YES.*from '@island.is/application/core'" libs/application/templates/estate/ -g '*.ts' -g '*.tsx'
rg "import.*NO.*from '@island.is/application/core'" libs/application/templates/estate/ -g '*.ts' -g '*.tsx'

# Test 3: Check for local constant definitions of YES and NO
echo "Checking for local constant definitions of YES and NO:"
rg "const\s+YES\s*=|const\s+NO\s*=" libs/application/templates/estate/ -g '*.ts' -g '*.tsx'

Length of output: 4085

libs/application/templates/estate/src/forms/Overviews.ts (1)

Line range hint 1-217: Changes align with coding guidelines and maintain functionality.

The modifications to the imports and subsequent usage of YES and NO constants throughout the file maintain the existing functionality while improving code consistency. The changes adhere to the following guidelines:

  1. Reusability of components and hooks across different NextJS apps.
  2. TypeScript usage for defining props and exporting types.
  3. Effective tree-shaking and bundling practices.

The overall structure of the file, including the use of buildSection, buildMultiField, and other utility functions, remains intact and continues to support these practices.

libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts (2)

12-12: LGTM: Import of shared constants enhances consistency.

The import of NO and YES constants from @island.is/application/core aligns with the coding guidelines for reusability across different NextJS apps. This change promotes consistency in the codebase.


Line range hint 1-248: Verify: Overall impact of changes is positive and localized.

The modifications in this file are well-contained within the estateMemberMapper function and do not introduce breaking changes to the public API. The updates improve type safety and enhance the handling of foreign citizenship cases.

To ensure the changes don't have unintended consequences, please run the following verification script:

This script will help ensure that:

  1. The NO and YES constants are properly imported and used.
  2. There are no remaining hardcoded 'No' or 'Yes' strings that should be replaced with the constants.
  3. The estateMemberMapper function is used consistently across the codebase.
✅ Verification successful

Verified: Changes are correctly implemented and localized.

The NO and YES constants are properly imported and utilized within mappers.ts. Additionally, there are no remaining hardcoded 'No' or 'Yes' strings. The estateMemberMapper function is consistently used across the codebase, ensuring uniform behavior.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of NO and YES constants, and check for any remaining hardcoded 'No' or 'Yes' strings.

# Test 1: Check for proper import and usage of NO and YES constants
echo "Test 1: Verifying import and usage of NO and YES constants"
rg --type typescript "import.*\{.*(?:NO|YES).*\}.*from '@island.is/application/core'" libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts
rg --type typescript "\b(NO|YES)\b" libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts

# Test 2: Check for any remaining hardcoded 'No' or 'Yes' strings
echo "Test 2: Checking for hardcoded 'No' or 'Yes' strings"
rg --type typescript "'(?:No|Yes)'" libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts

# Test 3: Verify usage of estateMemberMapper function
echo "Test 3: Verifying usage of estateMemberMapper function"
rg --type typescript "estateMemberMapper" libs

Length of output: 999


Script:

#!/bin/bash
# Description: Verify the usage of NO and YES constants, and check for any remaining hardcoded 'No' or 'Yes' strings.

# Test 1: Check for proper import and usage of NO and YES constants
echo "Test 1: Verifying import and usage of NO and YES constants"
rg "import.*\{.*(?:NO|YES).*\}.*from '@island.is/application/core'" --glob '*.ts' libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts
rg "\b(NO|YES)\b" --glob '*.ts' libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts

# Test 2: Check for any remaining hardcoded 'No' or 'Yes' strings
echo "Test 2: Checking for hardcoded 'No' or 'Yes' strings"
rg "'(?:No|Yes)'" --glob '*.ts' libs/application/template-api-modules/src/lib/modules/templates/estate/utils/mappers.ts

# Test 3: Verify usage of estateMemberMapper function
echo "Test 3: Verifying usage of estateMemberMapper function"
rg "estateMemberMapper" --glob '*.ts' libs

Length of output: 2040

libs/application/templates/estate/src/forms/Sections/estateAssets.ts (2)

Line range hint 18-23: LGTM: Correct usage of imported YES constant.

The YES constant is correctly used in the condition for the estateAssets section. The logic remains unchanged, maintaining the existing behavior while benefiting from the improved import consistency.


Line range hint 1-359: Approved: Excellent adherence to coding guidelines.

The code demonstrates strong adherence to the coding guidelines for libs/**/*:

  1. It uses TypeScript for defining props and exporting types.
  2. The components and hooks are designed for reusability across different NextJS apps.
  3. The modular structure supports effective tree-shaking and bundling.

The use of utility functions like buildSection, buildSubSection, etc., promotes consistency and reusability throughout the codebase.

libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx (2)

19-19: Improved imports for better reusability and tree-shaking

The changes in the import statements, particularly the addition of hasYes and YES from @island.is/application/core, align well with our coding guidelines. This modification enhances reusability across different NextJS apps and supports effective tree-shaking and bundling practices.

Also applies to: 23-23


Line range hint 1-324: Overall assessment: Improved type safety and consistency

The changes in this file demonstrate a commendable effort to enhance type safety, consistency, and alignment with core package usage. The modifications adhere well to the coding guidelines for libs/**/* files, particularly in terms of:

  1. Improving reusability across different NextJS apps
  2. Enhancing TypeScript usage for better type definitions
  3. Supporting effective tree-shaking and bundling practices

The refactoring of imports, the use of core constants, and the improvements in conditional logic all contribute to a more maintainable and robust component. The suggested minor improvements in the previous comments, if implemented, would further enhance code clarity and organization.

Great job on these improvements! The changes will contribute to a more consistent and maintainable codebase.

libs/application/templates/estate/src/lib/dataSchema.ts (2)

3-3: LGTM: Import changes improve consistency and follow best practices.

The change to import NO and YES from '@island.is/application/core' aligns with the coding guidelines for effective tree-shaking and bundling practices. It also enhances consistency by using shared constants across the application.

Also applies to: 12-12


105-106: LGTM: Improved type safety for noContactInfo field.

The change to use z.union([z.literal(YES), z.literal(NO)]) for the noContactInfo field improves type safety and ensures consistency with the rest of the application by using the imported constants.

libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx (1)

19-19: Improved code maintainability with constant import

The addition of the YES constant import from '@island.is/application/core' enhances code maintainability and consistency. This change aligns well with the coding guidelines for reusability across different NextJS apps.

libs/clients/syslumenn/src/lib/syslumennClient.utils.ts (2)

542-542: LGTM! Consistent with previous update.

The change to the knowledgeOfOtherWills property in the mapEstateInfo function is consistent with the update in the mapEstateRegistrant function. This consistency is good for maintaining a uniform approach across the codebase.


444-444: LGTM! Verify consistency across the codebase.

The update to the knowledgeOfOtherWills property, converting the boolean value to 'yes' or 'no' strings, looks good. This change likely improves consistency or meets specific API requirements.

To ensure this change is consistent with other parts of the codebase, please run the following script:

This will help identify if similar conversions are used elsewhere in the codebase, ensuring a uniform approach.

✅ Verification successful

Please update the search command to use the correct file type and rerun the verification.

To fix the previous error, use ts as the file type identifier. Please execute the following script to verify consistency across the codebase:


Consistency Verified

All instances of knowledgeOfOtherWills consistently use 'yes' or 'no' strings across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of 'knowledgeOfOtherWills' to verify consistency
rg --type typescript 'knowledgeOfOtherWills.*[?:].*yes.*:.*no' -g '!*.test.ts'

Length of output: 115


Script:

#!/bin/bash
# Search for other occurrences of 'knowledgeOfOtherWills' to verify consistency
rg --type ts 'knowledgeOfOtherWills.*[?:].*yes.*:.*no' -g '!*.test.ts'

Length of output: 333

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 10, 2024

Datadog Report

All test runs 5c5e1e6 🔗

18 Total Test Services: 0 Failed, 18 Passed
🔻 Test Sessions change in coverage: 3 decreased, 32 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 3.21s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.43s 1 no change Link
api-domains-mortgage-certificate 0 0 0 5 0 16.97s 1 no change Link
application-api-files 0 0 0 12 0 5.66s 1 no change Link
application-system-api 0 0 0 120 2 3m 2.91s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 14.79s 1 no change Link
application-ui-shell 0 0 0 74 0 30.06s 1 no change Link
auth-api-lib 0 0 0 20 0 31.47s 1 no change Link
clients-syslumenn 0 0 0 27 0 15.2s 1 no change Link
services-auth-admin-api 0 0 0 128 0 3m 3.87s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • services-auth-delegation-api - jest 51.23% (-0.19%) - Details
  • application-templates-estate - jest 18.88% (-0.04%) - Details
  • services-auth-personal-representative - jest 44.01% (-0.01%) - Details

Copy link
Member

@rafnarnason rafnarnason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM minor comments

@juni-haukur juni-haukur added the deploy-feature Deploys features to dev label Oct 14, 2024
Copy link
Contributor

Affected services are: api,application-system-api,services-auth-admin-api,services-auth-ids-api,services-auth-delegation-api,services-auth-personal-representative,services-auth-personal-representative-public,services-auth-public-api,services-user-notification,services-user-profile,application-system-form,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://fixestate-preregistered-heir-api-catalogue.dev01.devland.is/api
https://fixestate-preregistered-heir-application-callback-xrd.internal.dev01.devland.is/application-payment
https://fixestate-preregistered-heir-application-callback-xrd.internal.dev01.devland.is/applications
https://fixestate-preregistered-heir-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://fixestate-preregistered-heir-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://fixestate-preregistered-heir-beta.dev01.devland.is/
https://fixestate-preregistered-heir-beta.dev01.devland.is/api
https://fixestate-preregistered-heir-beta.dev01.devland.is/samradsgatt
https://fixestate-preregistered-heir-beta.dev01.devland.is/umsoknir
https://fixestate-preregistered-heir-service-portal-api.internal.dev01.devland.is/

Deployed services: application-system-api,application-system-form,service-portal-api,api,application-system-api-worker,consultation-portal,web.
Excluded services: user-notification,user-notification-worker,user-notification-cleanup-worker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-feature Deploys features to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants