-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/update-error-handling-in-useValidateCo…
…mponent
- Loading branch information
Showing
54 changed files
with
569 additions
and
376 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
using JetBrains.Annotations; | ||
|
||
namespace Altinn.Studio.Designer.Models.Dto; | ||
|
||
public class OptionListData | ||
{ | ||
[JsonPropertyName("title")] | ||
public string Title { get; set; } | ||
[JsonPropertyName("data")] | ||
[CanBeNull] public List<Option> Data { get; set; } | ||
[JsonPropertyName("hasError")] | ||
public bool? HasError { get; set; } | ||
} |
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
41 changes: 0 additions & 41 deletions
41
...nd/app-development/features/appContentLibrary/utils/convertOptionListsToCodeLists.test.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
frontend/app-development/features/appContentLibrary/utils/convertOptionListsToCodeLists.ts
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
...velopment/features/appContentLibrary/utils/convertOptionsListsDataToCodeListsData.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,49 @@ | ||
import type { CodeListData } from '@studio/content-library'; | ||
import { convertOptionsListsDataToCodeListsData } from './convertOptionsListsDataToCodeListsData'; | ||
import type { OptionsListsResponse } from 'app-shared/types/api/OptionsLists'; | ||
|
||
describe('convertOptionsListsDataToCodeListsData', () => { | ||
it('converts option lists data to code lists data correctly', () => { | ||
const optionListId: string = 'optionListId'; | ||
const optionListsData: OptionsListsResponse = [ | ||
{ | ||
title: optionListId, | ||
data: [ | ||
{ label: 'Option 1', value: '1' }, | ||
{ label: 'Option 2', value: '2' }, | ||
], | ||
hasError: false, | ||
}, | ||
]; | ||
const result: CodeListData[] = convertOptionsListsDataToCodeListsData(optionListsData); | ||
expect(result).toEqual([ | ||
{ | ||
title: optionListId, | ||
data: [ | ||
{ label: 'Option 1', value: '1' }, | ||
{ label: 'Option 2', value: '2' }, | ||
], | ||
hasError: false, | ||
}, | ||
]); | ||
}); | ||
|
||
it('sets hasError to true in result when optionListsResponse returns an option list with error', () => { | ||
const optionListId: string = 'optionListId'; | ||
const optionListsData: OptionsListsResponse = [ | ||
{ | ||
title: optionListId, | ||
data: null, | ||
hasError: true, | ||
}, | ||
]; | ||
const result: CodeListData[] = convertOptionsListsDataToCodeListsData(optionListsData); | ||
expect(result).toEqual([{ title: optionListId, data: null, hasError: true }]); | ||
}); | ||
|
||
it('returns a result with empty code list data array when the input option list data is empty', () => { | ||
const optionListsData: OptionsListsResponse = []; | ||
const result: CodeListData[] = convertOptionsListsDataToCodeListsData(optionListsData); | ||
expect(result).toEqual([]); | ||
}); | ||
}); |
Oops, something went wrong.