From eed3332efb0a2a341170c4c592085f715d3e5ea6 Mon Sep 17 00:00:00 2001 From: Nina Kylstad Date: Tue, 30 Jan 2024 15:49:16 +0100 Subject: [PATCH 01/26] update use-cases yml --- frontend/testing/cypress/use-cases.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/testing/cypress/use-cases.yaml b/frontend/testing/cypress/use-cases.yaml index 5693c831525..b639b945589 100644 --- a/frontend/testing/cypress/use-cases.yaml +++ b/frontend/testing/cypress/use-cases.yaml @@ -16,7 +16,7 @@ schedules: displayName: Bruksmønster branches: include: - - master + - main always: true steps: From 36554c6943ba9c32ca80a2c7e44c7c10bd981a05 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 14 May 2024 09:56:02 +0200 Subject: [PATCH 02/26] Begin work --- .../Controllers/DatamodelsController.cs | 19 +++++++++++++++---- .../Designer/Controllers/HomeController.cs | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/src/Designer/Controllers/DatamodelsController.cs b/backend/src/Designer/Controllers/DatamodelsController.cs index 51ebeca1616..b2184d606fe 100644 --- a/backend/src/Designer/Controllers/DatamodelsController.cs +++ b/backend/src/Designer/Controllers/DatamodelsController.cs @@ -12,6 +12,7 @@ using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; using Altinn.Studio.Designer.ViewModels.Request; +using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -54,13 +55,23 @@ public DatamodelsController(ISchemaModelService schemaModelService, IJsonSchemaV [HttpGet] [ProducesResponseType(StatusCodes.Status200OK)] [Route("datamodel")] - public async Task> Get([FromRoute] string org, [FromRoute] string repository, [FromQuery] string modelPath, CancellationToken cancellationToken) + public async Task> Get([FromRoute] string org, [FromRoute] string repository, [FromQuery] [CanBeNull] string modelPath, CancellationToken cancellationToken) { - var decodedPath = Uri.UnescapeDataString(modelPath); - var developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repository, developer); - var json = await _schemaModelService.GetSchema(editingContext, decodedPath, cancellationToken); + + string json; + if (string.IsNullOrEmpty(modelPath)) + { + // Get default data model + // Not sure if this is the correct way to get the default data model + json = _schemaModelService.GetSchemaFiles(editingContext)[0].ToString(); + } + else + { + var decodedPath = Uri.UnescapeDataString(modelPath); + json = await _schemaModelService.GetSchema(editingContext, decodedPath, cancellationToken); + } return Ok(json); } diff --git a/backend/src/Designer/Controllers/HomeController.cs b/backend/src/Designer/Controllers/HomeController.cs index 53456897ca9..f3b92d16f10 100644 --- a/backend/src/Designer/Controllers/HomeController.cs +++ b/backend/src/Designer/Controllers/HomeController.cs @@ -63,6 +63,7 @@ public HomeController( /// the default page for altinn studio when the user is not logged in /// /// The start page + [HttpGet] [Route("/")] [Route("/[controller]")] [Route("/[controller]/[action]/{id?}", Name = "DefaultNotLoggedIn")] From 506d9797268bfa792b965d8db2ef731be4d40b58 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 14 May 2024 12:49:37 +0200 Subject: [PATCH 03/26] Make route 'model-metadata' take optional parameter dataModelName --- .../Controllers/AppDevelopmentController.cs | 106 ++++++++++++------ .../Controllers/DatamodelsController.cs | 19 +--- .../Designer/Controllers/HomeController.cs | 1 - .../Implementation/AppDevelopmentService.cs | 90 +++++++++++---- .../Interfaces/IAppDevelopmentService.cs | 3 +- 5 files changed, 142 insertions(+), 77 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index 3c3b46ea47f..4d847dedb0f 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -12,6 +12,7 @@ using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Models.Dto; using Altinn.Studio.Designer.Services.Interfaces; +using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -42,7 +43,9 @@ public class AppDevelopmentController : Controller /// The source control service. /// /// An - public AppDevelopmentController(IAppDevelopmentService appDevelopmentService, IRepository repositoryService, ISourceControl sourceControl, IAltinnGitRepositoryFactory altinnGitRepositoryFactory, ApplicationInsightsSettings applicationInsightsSettings) + public AppDevelopmentController(IAppDevelopmentService appDevelopmentService, IRepository repositoryService, + ISourceControl sourceControl, IAltinnGitRepositoryFactory altinnGitRepositoryFactory, + ApplicationInsightsSettings applicationInsightsSettings) { _appDevelopmentService = appDevelopmentService; _repository = repositoryService; @@ -74,13 +77,15 @@ public IActionResult Index(string org, string app) [HttpGet] [UseSystemTextJson] [Route("form-layouts")] - public async Task GetFormLayouts(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task GetFormLayouts(string org, string app, [FromQuery] string layoutSetName, + CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - Dictionary formLayouts = await _appDevelopmentService.GetFormLayouts(editingContext, layoutSetName, cancellationToken); + Dictionary formLayouts = + await _appDevelopmentService.GetFormLayouts(editingContext, layoutSetName, cancellationToken); return Ok(formLayouts); } catch (FileNotFoundException exception) @@ -106,13 +111,15 @@ public async Task GetFormLayouts(string org, string app, [FromQue [HttpPost] [UseSystemTextJson] [Route("form-layout/{layoutName}")] - public async Task SaveFormLayout(string org, string app, [FromQuery] string layoutSetName, [FromRoute] string layoutName, [FromBody] JsonNode formLayout, CancellationToken cancellationToken) + public async Task SaveFormLayout(string org, string app, [FromQuery] string layoutSetName, + [FromRoute] string layoutName, [FromBody] JsonNode formLayout, CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - await _appDevelopmentService.SaveFormLayout(editingContext, layoutSetName, layoutName, formLayout, cancellationToken); + await _appDevelopmentService.SaveFormLayout(editingContext, layoutSetName, layoutName, formLayout, + cancellationToken); return Ok(); } catch (FileNotFoundException exception) @@ -131,7 +138,8 @@ public async Task SaveFormLayout(string org, string app, [FromQuer /// A success message if the save was successful [HttpDelete] [Route("form-layout/{layoutName}")] - public ActionResult DeleteFormLayout(string org, string app, [FromQuery] string layoutSetName, [FromRoute] string layoutName) + public ActionResult DeleteFormLayout(string org, string app, [FromQuery] string layoutSetName, + [FromRoute] string layoutName) { try { @@ -157,7 +165,8 @@ public ActionResult DeleteFormLayout(string org, string app, [FromQuery] string /// A success message if the save was successful [HttpPost] [Route("form-layout-name/{layoutName}")] - public ActionResult UpdateFormLayoutName(string org, string app, [FromQuery] string layoutSetName, [FromRoute] string layoutName, [FromBody] string newName) + public ActionResult UpdateFormLayoutName(string org, string app, [FromQuery] string layoutSetName, + [FromRoute] string layoutName, [FromBody] string newName) { try { @@ -184,13 +193,15 @@ public ActionResult UpdateFormLayoutName(string org, string app, [FromQuery] str [HttpPost] [UseSystemTextJson] [Route("layout-settings")] - public async Task SaveLayoutSettings(string org, string app, [FromQuery] string layoutSetName, [FromBody] JsonNode layoutSettings, CancellationToken cancellationToken) + public async Task SaveLayoutSettings(string org, string app, [FromQuery] string layoutSetName, + [FromBody] JsonNode layoutSettings, CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - await _appDevelopmentService.SaveLayoutSettings(editingContext, layoutSettings, layoutSetName, cancellationToken); + await _appDevelopmentService.SaveLayoutSettings(editingContext, layoutSettings, layoutSetName, + cancellationToken); return Ok(); } catch (FileNotFoundException exception) @@ -210,13 +221,15 @@ public async Task SaveLayoutSettings(string org, string app, [From [HttpGet] [UseSystemTextJson] [Route("layout-settings")] - public async Task GetLayoutSettings(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task GetLayoutSettings(string org, string app, [FromQuery] string layoutSetName, + CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - var layoutSettings = await _appDevelopmentService.GetLayoutSettings(editingContext, layoutSetName, cancellationToken); + var layoutSettings = + await _appDevelopmentService.GetLayoutSettings(editingContext, layoutSetName, cancellationToken); return Ok(layoutSettings); } catch (FileNotFoundException exception) @@ -258,10 +271,13 @@ public async Task GetLayoutNames(string org, string app, Cancella [HttpGet] [UseSystemTextJson] [Route("model-ids")] - public async Task GetAppMetadataDataModelIds(string org, string app, CancellationToken cancellationToken, [FromQuery] bool onlyUnReferenced = false) + public async Task GetAppMetadataDataModelIds(string org, string app, + CancellationToken cancellationToken, [FromQuery] bool onlyUnReferenced = false) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - IEnumerable dataModelIds = await _appDevelopmentService.GetAppMetadataModelIds(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), onlyUnReferenced, cancellationToken); + IEnumerable dataModelIds = await _appDevelopmentService.GetAppMetadataModelIds( + AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), onlyUnReferenced, + cancellationToken); return Ok(dataModelIds); } @@ -271,15 +287,19 @@ public async Task GetAppMetadataDataModelIds(string org, string a /// Unique identifier of the organisation responsible for the app. /// Application identifier which is unique within an organisation. /// Name of current layoutSet in ux-editor that edited layout belongs to + /// Name of data model to fetch (optional) /// An that observes if operation is cancelled. /// The model as JSON [HttpGet] [UseSystemTextJson] [Route("model-metadata")] - public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, + [FromQuery] [CanBeNull] string dataModelName, CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), layoutSetName, cancellationToken); + ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata( + AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), layoutSetName, dataModelName, + cancellationToken); return Ok(modelMetadata); } @@ -311,11 +331,13 @@ public async Task GetLayoutSets(string org, string app, Cancellat [HttpPost] [UseSystemTextJson] [Route("layout-set/{layoutSetIdToUpdate}")] - public async Task AddLayoutSet(string org, string app, [FromBody] LayoutSetConfig layoutSet, CancellationToken cancellationToken) + public async Task AddLayoutSet(string org, string app, [FromBody] LayoutSetConfig layoutSet, + CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - LayoutSets layoutSets = await _appDevelopmentService.AddLayoutSet(editingContext, layoutSet, cancellationToken); + LayoutSets layoutSets = + await _appDevelopmentService.AddLayoutSet(editingContext, layoutSet, cancellationToken); return Ok(layoutSets); } @@ -330,11 +352,14 @@ public async Task AddLayoutSet(string org, string app, [FromBody] [HttpPut] [UseSystemTextJson] [Route("layout-set/{layoutSetIdToUpdate}")] - public async Task UpdateLayoutSetName(string org, string app, [FromRoute] string layoutSetIdToUpdate, [FromBody] string newLayoutSetName, CancellationToken cancellationToken) + public async Task UpdateLayoutSetName(string org, string app, + [FromRoute] string layoutSetIdToUpdate, [FromBody] string newLayoutSetName, + CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - LayoutSets layoutSets = await _appDevelopmentService.UpdateLayoutSetName(editingContext, layoutSetIdToUpdate, newLayoutSetName, cancellationToken); + LayoutSets layoutSets = await _appDevelopmentService.UpdateLayoutSetName(editingContext, + layoutSetIdToUpdate, newLayoutSetName, cancellationToken); return Ok(layoutSets); } @@ -348,11 +373,13 @@ public async Task UpdateLayoutSetName(string org, string app, [Fro [HttpDelete] [UseSystemTextJson] [Route("layout-set/{layoutSetIdToUpdate}")] - public async Task DeleteLayoutSet(string org, string app, [FromRoute] string layoutSetIdToUpdate, CancellationToken cancellationToken) + public async Task DeleteLayoutSet(string org, string app, [FromRoute] string layoutSetIdToUpdate, + CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - LayoutSets layoutSets = await _appDevelopmentService.DeleteLayoutSet(editingContext, layoutSetIdToUpdate, cancellationToken); + LayoutSets layoutSets = + await _appDevelopmentService.DeleteLayoutSet(editingContext, layoutSetIdToUpdate, cancellationToken); return Ok(layoutSets); } @@ -366,13 +393,15 @@ public async Task DeleteLayoutSet(string org, string app, [FromRou /// The model representation as JSON [HttpGet] [Route("rule-handler")] - public async Task GetRuleHandler(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task GetRuleHandler(string org, string app, [FromQuery] string layoutSetName, + CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - string ruleHandler = await _appDevelopmentService.GetRuleHandler(editingContext, layoutSetName, cancellationToken); + string ruleHandler = + await _appDevelopmentService.GetRuleHandler(editingContext, layoutSetName, cancellationToken); return Content(ruleHandler); } catch (FileNotFoundException) @@ -395,7 +424,8 @@ public async Task GetRuleHandler(string org, string app, [FromQue /// The model representation as JSON [HttpPost] [Route("rule-handler")] - public async Task SaveRuleHandler(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task SaveRuleHandler(string org, string app, [FromQuery] string layoutSetName, + CancellationToken cancellationToken) { try { @@ -404,7 +434,8 @@ public async Task SaveRuleHandler(string org, string app, [FromQu { var content = await reader.ReadToEndAsync(cancellationToken); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - await _appDevelopmentService.SaveRuleHandler(editingContext, content, layoutSetName, cancellationToken); + await _appDevelopmentService.SaveRuleHandler(editingContext, content, layoutSetName, + cancellationToken); } return NoContent(); @@ -427,13 +458,15 @@ public async Task SaveRuleHandler(string org, string app, [FromQu [HttpPost] [UseSystemTextJson] [Route("rule-config")] - public async Task SaveRuleConfig(string org, string app, [FromBody] JsonNode ruleConfig, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task SaveRuleConfig(string org, string app, [FromBody] JsonNode ruleConfig, + [FromQuery] string layoutSetName, CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - await _appDevelopmentService.SaveRuleConfig(editingContext, ruleConfig, layoutSetName, cancellationToken); + await _appDevelopmentService.SaveRuleConfig(editingContext, ruleConfig, layoutSetName, + cancellationToken); return Ok(); } catch (Exception exception) @@ -452,13 +485,16 @@ public async Task SaveRuleConfig(string org, string app, [FromBod /// The model representation as JSON [HttpGet] [Route("rule-config")] - public async Task GetRuleConfig(string org, string app, [FromQuery] string layoutSetName, CancellationToken cancellationToken) + public async Task GetRuleConfig(string org, string app, [FromQuery] string layoutSetName, + CancellationToken cancellationToken) { try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); - string ruleConfig = await _appDevelopmentService.GetRuleConfigAndAddDataToRootIfNotAlreadyPresent(editingContext, layoutSetName, cancellationToken); + string ruleConfig = + await _appDevelopmentService.GetRuleConfigAndAddDataToRootIfNotAlreadyPresent(editingContext, + layoutSetName, cancellationToken); return Content(ruleConfig); } catch (FileNotFoundException) @@ -483,7 +519,8 @@ public async Task GetRuleConfig(string org, string app, [FromQuer public ActionResult GetWidgetSettings(string org, string app) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - string widgetSettings = _repository.GetWidgetSettings(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer)); + string widgetSettings = + _repository.GetWidgetSettings(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer)); return Ok(widgetSettings); } @@ -494,7 +531,8 @@ public ActionResult GetOptionListIds(string org, string app) try { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(org, app, developer); + AltinnAppGitRepository altinnAppGitRepository = + _altinnGitRepositoryFactory.GetAltinnAppGitRepository(org, app, developer); string[] optionListIds = altinnAppGitRepository.GetOptionListIds(); return Ok(optionListIds); } @@ -513,11 +551,7 @@ public VersionResponse GetAppVersion(string org, string app) var backendVersion = _appDevelopmentService.GetAppLibVersion(editingContext); _appDevelopmentService.TryGetFrontendVersion(editingContext, out string frontendVersion); - return new VersionResponse - { - BackendVersion = backendVersion, - FrontendVersion = frontendVersion - }; + return new VersionResponse { BackendVersion = backendVersion, FrontendVersion = frontendVersion }; } } } diff --git a/backend/src/Designer/Controllers/DatamodelsController.cs b/backend/src/Designer/Controllers/DatamodelsController.cs index b2184d606fe..51ebeca1616 100644 --- a/backend/src/Designer/Controllers/DatamodelsController.cs +++ b/backend/src/Designer/Controllers/DatamodelsController.cs @@ -12,7 +12,6 @@ using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; using Altinn.Studio.Designer.ViewModels.Request; -using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -55,23 +54,13 @@ public DatamodelsController(ISchemaModelService schemaModelService, IJsonSchemaV [HttpGet] [ProducesResponseType(StatusCodes.Status200OK)] [Route("datamodel")] - public async Task> Get([FromRoute] string org, [FromRoute] string repository, [FromQuery] [CanBeNull] string modelPath, CancellationToken cancellationToken) + public async Task> Get([FromRoute] string org, [FromRoute] string repository, [FromQuery] string modelPath, CancellationToken cancellationToken) { + var decodedPath = Uri.UnescapeDataString(modelPath); + var developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repository, developer); - - string json; - if (string.IsNullOrEmpty(modelPath)) - { - // Get default data model - // Not sure if this is the correct way to get the default data model - json = _schemaModelService.GetSchemaFiles(editingContext)[0].ToString(); - } - else - { - var decodedPath = Uri.UnescapeDataString(modelPath); - json = await _schemaModelService.GetSchema(editingContext, decodedPath, cancellationToken); - } + var json = await _schemaModelService.GetSchema(editingContext, decodedPath, cancellationToken); return Ok(json); } diff --git a/backend/src/Designer/Controllers/HomeController.cs b/backend/src/Designer/Controllers/HomeController.cs index f3b92d16f10..53456897ca9 100644 --- a/backend/src/Designer/Controllers/HomeController.cs +++ b/backend/src/Designer/Controllers/HomeController.cs @@ -63,7 +63,6 @@ public HomeController( /// the default page for altinn studio when the user is not logged in /// /// The start page - [HttpGet] [Route("/")] [Route("/[controller]")] [Route("/[controller]/[action]/{id?}", Name = "DefaultNotLoggedIn")] diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 657fae0a2dd..0cfc3fc7456 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -34,7 +35,8 @@ public class AppDevelopmentService : IAppDevelopmentService /// /// IAltinnGitRepository /// ISchemaModelService - public AppDevelopmentService(IAltinnGitRepositoryFactory altinnGitRepositoryFactory, ISchemaModelService schemaModelService) + public AppDevelopmentService(IAltinnGitRepositoryFactory altinnGitRepositoryFactory, + ISchemaModelService schemaModelService) { _altinnGitRepositoryFactory = altinnGitRepositoryFactory; _schemaModelService = schemaModelService; @@ -154,7 +156,8 @@ public async Task SaveLayoutSettings(AltinnRepoEditingContext altinnRepoEditingC } /// - public async Task GetLayoutNames(AltinnRepoEditingContext altinnRepoEditingContext, CancellationToken cancellationToken = default) + public async Task GetLayoutNames(AltinnRepoEditingContext altinnRepoEditingContext, + CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); AltinnAppGitRepository altinnAppGitRepository = @@ -170,6 +173,7 @@ public async Task GetLayoutNames(AltinnRepoEditingContext altinnRepoEd string[] layoutNamesForSet = altinnAppGitRepository.GetLayoutNames(layoutSetConfig.Id); layoutNames = layoutNames.Concat(layoutNamesForSet).ToArray(); } + return layoutNames; } @@ -177,7 +181,8 @@ public async Task GetLayoutNames(AltinnRepoEditingContext altinnRepoEd } /// - public async Task> GetAppMetadataModelIds(AltinnRepoEditingContext altinnRepoEditingContext, bool onlyUnReferenced, + public async Task> GetAppMetadataModelIds(AltinnRepoEditingContext altinnRepoEditingContext, + bool onlyUnReferenced, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -191,14 +196,27 @@ public async Task> GetAppMetadataModelIds(AltinnRepoEditingC /// public async Task GetModelMetadata(AltinnRepoEditingContext altinnRepoEditingContext, - string layoutSetName, CancellationToken cancellationToken = default) + string layoutSetName, string dataModelName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); - AltinnAppGitRepository altinnAppGitRepository = - _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, - altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); + AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository( + altinnRepoEditingContext.Org, + altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); ApplicationMetadata applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(cancellationToken); + + string modelPath; + ModelMetadata modelMetadata; + + if (!string.IsNullOrEmpty(dataModelName)) + { + modelPath = $"App/models/{dataModelName}.schema.json"; + modelMetadata = + await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, + cancellationToken); + return modelMetadata; + } + // get task_id since we might not maintain dataType ref in layout-sets-file string taskId = await GetTaskIdBasedOnLayoutSet(altinnRepoEditingContext, layoutSetName, cancellationToken); string modelName = GetModelName(applicationMetadata, taskId); @@ -206,8 +224,11 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin { return new ModelMetadata(); } - string modelPath = $"App/models/{modelName}.schema.json"; - ModelMetadata modelMetadata = await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, cancellationToken); + + modelPath = $"App/models/{modelName}.schema.json"; + modelMetadata = + await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, + cancellationToken); return modelMetadata; } @@ -216,16 +237,21 @@ private string GetModelName(ApplicationMetadata applicationMetadata, [CanBeNull] // fallback to first model if no task_id is provided (no layout sets) if (taskId == null) { - return applicationMetadata.DataTypes.FirstOrDefault(data => data.AppLogic != null && !string.IsNullOrEmpty(data.AppLogic.ClassRef) && !string.IsNullOrEmpty(data.TaskId))?.Id ?? string.Empty; + return applicationMetadata.DataTypes.FirstOrDefault(data => + data.AppLogic != null && !string.IsNullOrEmpty(data.AppLogic.ClassRef) && + !string.IsNullOrEmpty(data.TaskId))?.Id ?? string.Empty; } PlatformStorageModels.DataType data = applicationMetadata.DataTypes - .FirstOrDefault(data => data.AppLogic != null && DoesDataTaskMatchTaskId(data, taskId) && !string.IsNullOrEmpty(data.AppLogic.ClassRef)); + .FirstOrDefault(data => + data.AppLogic != null && DoesDataTaskMatchTaskId(data, taskId) && + !string.IsNullOrEmpty(data.AppLogic.ClassRef)); return data?.Id ?? string.Empty; } - private IEnumerable GetAppMetadataModelIds(ApplicationMetadata applicationMetadata, bool onlyUnReferenced) + private IEnumerable GetAppMetadataModelIds(ApplicationMetadata applicationMetadata, + bool onlyUnReferenced) { var appMetaDataDataTypes = applicationMetadata.DataTypes .Where(data => data.AppLogic != null && !string.IsNullOrEmpty(data.AppLogic.ClassRef)); @@ -245,13 +271,15 @@ private bool DoesDataTaskMatchTaskId(PlatformStorageModels.DataType data, [CanBe return string.IsNullOrEmpty(taskId) || data.TaskId == taskId; } - private async Task GetTaskIdBasedOnLayoutSet(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) + private async Task GetTaskIdBasedOnLayoutSet(AltinnRepoEditingContext altinnRepoEditingContext, + string layoutSetName, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(layoutSetName)) { // App without layout sets --> no need for task_id, we just retrieve the first occurence of a dataType with a classRef return null; } + LayoutSets layoutSets = await GetLayoutSets(altinnRepoEditingContext, cancellationToken); return layoutSets?.Sets?.Find(set => set.Id == layoutSetName)?.Tasks[0]; @@ -289,25 +317,30 @@ public async Task AddLayoutSet(AltinnRepoEditingContext altinnRepoEd { throw new NoLayoutSetsFileFoundException("No layout set found for this app."); } + if (!Regex.IsMatch(newLayoutSet.Id, _layoutSetNameRegEx)) { throw new InvalidLayoutSetIdException("New layout set name is not valid."); } + LayoutSets layoutSets = await altinnAppGitRepository.GetLayoutSetsFile(cancellationToken); if (layoutSets.Sets.Exists(set => set.Id == newLayoutSet.Id)) { throw new NonUniqueLayoutSetIdException($"Layout set name, {newLayoutSet.Id}, already exists."); } + if (layoutSets.Sets.Exists(set => set.Tasks[0] == newLayoutSet.Tasks[0])) { - throw new NonUniqueTaskForLayoutSetException($"Layout set with task, {newLayoutSet.Tasks[0]}, already exists."); + throw new NonUniqueTaskForLayoutSetException( + $"Layout set with task, {newLayoutSet.Tasks[0]}, already exists."); } return await AddNewLayoutSet(altinnAppGitRepository, layoutSets, newLayoutSet); } /// - public async Task UpdateLayoutSetName(AltinnRepoEditingContext altinnRepoEditingContext, string oldLayoutSetName, + public async Task UpdateLayoutSetName(AltinnRepoEditingContext altinnRepoEditingContext, + string oldLayoutSetName, string newLayoutSetName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -316,19 +349,21 @@ public async Task UpdateLayoutSetName(AltinnRepoEditingContext altin altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); if (!altinnAppGitRepository.AppUsesLayoutSets()) { - throw new NoLayoutSetsFileFoundException("No layout set found for this app."); } + if (!Regex.IsMatch(newLayoutSetName, _layoutSetNameRegEx)) { throw new InvalidLayoutSetIdException("New layout set name is not valid."); } + LayoutSets layoutSets = await altinnAppGitRepository.GetLayoutSetsFile(cancellationToken); // NewLayoutSet Id is not the same as existing layout set Id so must check if the suggested new Id already exists if (layoutSets.Sets.Exists(set => set.Id == newLayoutSetName)) { throw new NonUniqueLayoutSetIdException($"Layout set name, {newLayoutSetName}, already exists."); } + // Layout set name is updated which means layout set folder must be updated also altinnAppGitRepository.ChangeLayoutSetFolderName(oldLayoutSetName, newLayoutSetName, cancellationToken); return await UpdateLayoutSetName(altinnAppGitRepository, layoutSets, oldLayoutSetName, newLayoutSetName); @@ -353,7 +388,8 @@ public async Task DeleteLayoutSet(AltinnRepoEditingContext altinnRep return await DeleteExistingLayoutSet(altinnAppGitRepository, layoutSets, layoutSetToDeleteId); } - private async Task DeleteTaskRefInApplicationMetadata(AltinnAppGitRepository altinnAppGitRepository, string dataTypeId) + private async Task DeleteTaskRefInApplicationMetadata(AltinnAppGitRepository altinnAppGitRepository, + string dataTypeId) { var applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(); var dataType = applicationMetadata.DataTypes.Find(dataType => dataType.Id == dataTypeId); @@ -361,7 +397,8 @@ private async Task DeleteTaskRefInApplicationMetadata(AltinnAppGitRepository alt await altinnAppGitRepository.SaveApplicationMetadata(applicationMetadata); } - private static async Task DeleteExistingLayoutSet(AltinnAppGitRepository altinnAppGitRepository, LayoutSets layoutSets, string layoutSetToDeleteId) + private static async Task DeleteExistingLayoutSet(AltinnAppGitRepository altinnAppGitRepository, + LayoutSets layoutSets, string layoutSetToDeleteId) { LayoutSetConfig layoutSetToDelete = layoutSets.Sets.Find(set => set.Id == layoutSetToDeleteId); layoutSets.Sets.Remove(layoutSetToDelete); @@ -369,7 +406,8 @@ private static async Task DeleteExistingLayoutSet(AltinnAppGitReposi return layoutSets; } - private static async Task AddNewLayoutSet(AltinnAppGitRepository altinnAppGitRepository, LayoutSets layoutSets, LayoutSetConfig layoutSet) + private static async Task AddNewLayoutSet(AltinnAppGitRepository altinnAppGitRepository, + LayoutSets layoutSets, LayoutSetConfig layoutSet) { layoutSets.Sets.Add(layoutSet); await altinnAppGitRepository.SaveLayout(layoutSet.Id, AltinnAppGitRepository.InitialLayoutFileName, @@ -380,7 +418,8 @@ await altinnAppGitRepository.SaveLayoutSettings(layoutSet.Id, return layoutSets; } - private async Task UpdateLayoutSetName(AltinnAppGitRepository altinnAppGitRepository, LayoutSets layoutSets, string oldLayoutSetName, string newLayoutSetName) + private async Task UpdateLayoutSetName(AltinnAppGitRepository altinnAppGitRepository, + LayoutSets layoutSets, string oldLayoutSetName, string newLayoutSetName) { layoutSets.Sets.Find(set => set.Id == oldLayoutSetName).Id = newLayoutSetName; await altinnAppGitRepository.SaveLayoutSetsFile(layoutSets); @@ -487,14 +526,16 @@ public SemanticVersion GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditi public bool TryGetFrontendVersion(AltinnRepoEditingContext altinnRepoEditingContext, out string version) { version = null; - AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, - altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); + AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository( + altinnRepoEditingContext.Org, + altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); string indexFilePath; try { - indexFilePath = altinnAppGitRepository.FindFiles(new[] { "App/views/Home/Index.cshtml" }).FirstOrDefault(); + indexFilePath = altinnAppGitRepository.FindFiles(new[] { "App/views/Home/Index.cshtml" }) + .FirstOrDefault(); } catch (DirectoryNotFoundException) { @@ -502,7 +543,8 @@ public bool TryGetFrontendVersion(AltinnRepoEditingContext altinnRepoEditingCont } - return indexFilePath is not null && AppFrontendVersionHelper.TryGetFrontendVersionFromIndexFile(indexFilePath, out version); + return indexFilePath is not null && + AppFrontendVersionHelper.TryGetFrontendVersionFromIndexFile(indexFilePath, out version); } } } diff --git a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs index a5683a5043c..2d1c6f299c0 100644 --- a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs +++ b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs @@ -92,10 +92,11 @@ public Task> GetAppMetadataModelIds( /// /// An . /// Name of layoutSet to fetch corresponding model metadata for + /// modelMetaData to fetch /// An that observes if operation is cancelled. /// The model metadata for a given layout set. public Task GetModelMetadata( - AltinnRepoEditingContext altinnRepoEditingContext, [CanBeNull] string layoutSetName, + AltinnRepoEditingContext altinnRepoEditingContext, [CanBeNull] string layoutSetName, [CanBeNull] string modelMetaData, CancellationToken cancellationToken = default); /// From 2db56fdde0c880603f0ed958e0fe1ec86bc5288d Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 14 May 2024 14:15:43 +0200 Subject: [PATCH 04/26] Add dataModelName to frontend path --- frontend/packages/shared/src/api/paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/packages/shared/src/api/paths.js b/frontend/packages/shared/src/api/paths.js index 104052927c7..7aa4fdb2a15 100644 --- a/frontend/packages/shared/src/api/paths.js +++ b/frontend/packages/shared/src/api/paths.js @@ -32,7 +32,7 @@ export const widgetSettingsPath = (org, app) => `${basePath}/${org}/${app}/app-d export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/app-development/option-list-ids`; // Get export const ruleConfigPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/rule-config?${s({ layoutSetName })}`; // Get, Post export const appMetadataModelIdsPath = (org, app, onlyUnReferenced) => `${basePath}/${org}/${app}/app-development/model-ids?${s({ onlyUnReferenced })}`; // Get -export const datamodelMetadataPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}`; // Get +export const datamodelMetadataPath = (org, app, layoutSetName, dataModelName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}?${s({ dataModelName })}`; // Get export const layoutNamesPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-names`; // Get export const layoutSetsPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-sets`; // Get export const layoutSetPath = (org, app, layoutSetIdToUpdate) => `${basePath}/${org}/${app}/app-development/layout-set/${layoutSetIdToUpdate}`; // Put, Delete From 27e8d28ba7c34031ccfbb8a567eb5f098bc218ac Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 14 May 2024 14:15:43 +0200 Subject: [PATCH 05/26] Add dataModelName to frontend path --- backend/src/Designer/Controllers/AppDevelopmentController.cs | 2 +- .../Designer/Services/Implementation/AppDevelopmentService.cs | 1 - frontend/packages/shared/src/api/paths.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index 4d847dedb0f..f49997634dd 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -294,7 +294,7 @@ public async Task GetAppMetadataDataModelIds(string org, string a [UseSystemTextJson] [Route("model-metadata")] public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, - [FromQuery] [CanBeNull] string dataModelName, CancellationToken cancellationToken) + [FromQuery][CanBeNull] string dataModelName, CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata( diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 0cfc3fc7456..7f6579c901d 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/frontend/packages/shared/src/api/paths.js b/frontend/packages/shared/src/api/paths.js index 104052927c7..7aa4fdb2a15 100644 --- a/frontend/packages/shared/src/api/paths.js +++ b/frontend/packages/shared/src/api/paths.js @@ -32,7 +32,7 @@ export const widgetSettingsPath = (org, app) => `${basePath}/${org}/${app}/app-d export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/app-development/option-list-ids`; // Get export const ruleConfigPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/rule-config?${s({ layoutSetName })}`; // Get, Post export const appMetadataModelIdsPath = (org, app, onlyUnReferenced) => `${basePath}/${org}/${app}/app-development/model-ids?${s({ onlyUnReferenced })}`; // Get -export const datamodelMetadataPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}`; // Get +export const datamodelMetadataPath = (org, app, layoutSetName, dataModelName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}?${s({ dataModelName })}`; // Get export const layoutNamesPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-names`; // Get export const layoutSetsPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-sets`; // Get export const layoutSetPath = (org, app, layoutSetIdToUpdate) => `${basePath}/${org}/${app}/app-development/layout-set/${layoutSetIdToUpdate}`; // Put, Delete From 85d864eaf2e69b5edf1411a5f49e57b49dd0c0ee Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Wed, 15 May 2024 08:40:20 +0200 Subject: [PATCH 06/26] Add tests for dataModelName param --- .../Controllers/AppDevelopmentController.cs | 2 +- .../Implementation/AppDevelopmentService.cs | 2 +- .../GetModelMetadataTests.cs | 47 +++++++++++++++++-- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index cbae0245a76..78ab337fdb2 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -278,7 +278,7 @@ public async Task GetAppMetadataDataModelIds(string org, string a [HttpGet] [UseSystemTextJson] [Route("model-metadata")] - public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, [FromQuery] [CanBeNull] string dataModelName, CancellationToken cancellationToken) + public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, [FromQuery] string dataModelName, CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), layoutSetName, dataModelName, cancellationToken); diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 492492e0bb7..35d32bca149 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -199,7 +199,7 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin string modelPath; ModelMetadata modelMetadata; - if (!string.IsNullOrEmpty(dataModelName)) + if (dataModelName != null) { modelPath = $"App/models/{dataModelName}.schema.json"; modelMetadata = await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, cancellationToken); diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 32d6972096b..b66e642b9cf 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -20,16 +20,38 @@ public GetModelMetadataTests(WebApplicationFactory factory) : base(fact } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", "TestData/Model/Metadata/datamodel.json")] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata(string org, string app, string developer, string layoutSetName, string expectedModelMetadataPath) + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null, "TestData/Model/Metadata/datamodel.json")] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, null, "TestData/Model/Metadata/datamodel.json")] + public async Task GetModelMetadata_Should_Return_ModelMetadata_From_LayoutSetParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}"; + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + + using var response = await HttpClient.SendAsync(httpRequestMessage); + response.StatusCode.Should().Be(HttpStatusCode.OK); + + string responseContent = await response.Content.ReadAsStringAsync(); + + responseContent.Should().Be(expectedModelMetadata); + JsonUtils.DeepEquals(expectedModelMetadata, responseContent).Should().BeTrue(); + } + + [Theory] + [InlineData("ttd", "app-with-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] + public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNameParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + + string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); + + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); using var response = await HttpClient.SendAsync(httpRequestMessage); @@ -44,7 +66,7 @@ public async Task GetModelMetadata_Should_Return_ModelMetadata(string org, strin [Theory] [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet3")] [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null)] - public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datamodel_Exists(string org, string app, string developer, string layoutSetName) + public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromLayoutSetParam(string org, string app, string developer, string layoutSetName) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); @@ -56,6 +78,21 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam response.StatusCode.Should().Be(HttpStatusCode.NotFound); } + [Theory] + [InlineData("ttd", "app-with-layoutsets", "testUser", null, "datamodel3")] + [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null, null)] + public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromDataModelNameParam(string org, string app, string developer, string layoutSetName, string dataModelName) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + + using var response = await HttpClient.SendAsync(httpRequestMessage); + response.StatusCode.Should().Be(HttpStatusCode.NotFound); + } + private async Task AddModelMetadataToRepo(string createdFolderPath, string expectedModelMetadataPath) { string modelMetadata = SharedResourcesHelper.LoadTestDataAsString(expectedModelMetadataPath); From 94d284f01f1066e339a162c8040072f084facce7 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Wed, 15 May 2024 08:40:20 +0200 Subject: [PATCH 07/26] Add tests for dataModelName param --- .../Controllers/AppDevelopmentController.cs | 2 +- .../Implementation/AppDevelopmentService.cs | 2 +- .../GetModelMetadataTests.cs | 47 +++++++++++++++++-- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index cbae0245a76..78ab337fdb2 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -278,7 +278,7 @@ public async Task GetAppMetadataDataModelIds(string org, string a [HttpGet] [UseSystemTextJson] [Route("model-metadata")] - public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, [FromQuery] [CanBeNull] string dataModelName, CancellationToken cancellationToken) + public async Task GetModelMetadata(string org, string app, [FromQuery] string layoutSetName, [FromQuery] string dataModelName, CancellationToken cancellationToken) { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), layoutSetName, dataModelName, cancellationToken); diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 492492e0bb7..35d32bca149 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -199,7 +199,7 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin string modelPath; ModelMetadata modelMetadata; - if (!string.IsNullOrEmpty(dataModelName)) + if (dataModelName != null) { modelPath = $"App/models/{dataModelName}.schema.json"; modelMetadata = await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, cancellationToken); diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 32d6972096b..23a4f720ba8 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -20,16 +20,38 @@ public GetModelMetadataTests(WebApplicationFactory factory) : base(fact } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", "TestData/Model/Metadata/datamodel.json")] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata(string org, string app, string developer, string layoutSetName, string expectedModelMetadataPath) + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null, "TestData/Model/Metadata/datamodel.json")] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, null, "TestData/Model/Metadata/datamodel.json")] + public async Task GetModelMetadata_Should_Return_ModelMetadata_From_LayoutSetParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}"; + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + + using var response = await HttpClient.SendAsync(httpRequestMessage); + response.StatusCode.Should().Be(HttpStatusCode.OK); + + string responseContent = await response.Content.ReadAsStringAsync(); + + responseContent.Should().Be(expectedModelMetadata); + JsonUtils.DeepEquals(expectedModelMetadata, responseContent).Should().BeTrue(); + } + + [Theory] + [InlineData("ttd", "app-with-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] + public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNameParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + + string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); + + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); using var response = await HttpClient.SendAsync(httpRequestMessage); @@ -44,7 +66,7 @@ public async Task GetModelMetadata_Should_Return_ModelMetadata(string org, strin [Theory] [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet3")] [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null)] - public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datamodel_Exists(string org, string app, string developer, string layoutSetName) + public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromLayoutSetParam(string org, string app, string developer, string layoutSetName) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); @@ -56,6 +78,21 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam response.StatusCode.Should().Be(HttpStatusCode.NotFound); } + [Theory] + [InlineData("ttd", "app-with-layoutsets", "testUser", "datamodel3")] + [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null)] + public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromDataModelNameParam(string org, string app, string developer, string dataModelName) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?dataModelName={dataModelName}"; + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + + using var response = await HttpClient.SendAsync(httpRequestMessage); + response.StatusCode.Should().Be(HttpStatusCode.NotFound); + } + private async Task AddModelMetadataToRepo(string createdFolderPath, string expectedModelMetadataPath) { string modelMetadata = SharedResourcesHelper.LoadTestDataAsString(expectedModelMetadataPath); From 29891741a681ed5393d697becb18b480b9697601 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Thu, 16 May 2024 13:23:18 +0200 Subject: [PATCH 08/26] Include layoutSet parameter in test --- .../AppDevelopmentController/GetModelMetadataTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 23a4f720ba8..7cf786e8322 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -6,6 +6,7 @@ using Designer.Tests.Utils; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.OpenApi.Models; using SharedResources.Tests; using Xunit; @@ -22,13 +23,12 @@ public GetModelMetadataTests(WebApplicationFactory factory) : base(fact [Theory] [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null, "TestData/Model/Metadata/datamodel.json")] [InlineData("ttd", "app-without-layoutsets", "testUser", null, null, "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata_From_LayoutSetParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_IsNull(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); @@ -42,9 +42,9 @@ public async Task GetModelMetadata_Should_Return_ModelMetadata_From_LayoutSetPar } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", "datamodel", "TestData/Model/Metadata/datamodel.json")] [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNameParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_IsSpecified(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); From bfff87ec7d164251c78d098688ec44fb42e35876 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Thu, 16 May 2024 13:33:44 +0200 Subject: [PATCH 09/26] Update path in paths.js --- frontend/packages/shared/src/api/paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/packages/shared/src/api/paths.js b/frontend/packages/shared/src/api/paths.js index 7aa4fdb2a15..8366218589a 100644 --- a/frontend/packages/shared/src/api/paths.js +++ b/frontend/packages/shared/src/api/paths.js @@ -32,7 +32,7 @@ export const widgetSettingsPath = (org, app) => `${basePath}/${org}/${app}/app-d export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/app-development/option-list-ids`; // Get export const ruleConfigPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/rule-config?${s({ layoutSetName })}`; // Get, Post export const appMetadataModelIdsPath = (org, app, onlyUnReferenced) => `${basePath}/${org}/${app}/app-development/model-ids?${s({ onlyUnReferenced })}`; // Get -export const datamodelMetadataPath = (org, app, layoutSetName, dataModelName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}?${s({ dataModelName })}`; // Get +export const datamodelMetadataPath = (org, app, layoutSetName, dataModelName) => `${basePath}/${org}/${app}/app-development/model-metadata?${s({ layoutSetName })}&${s({ dataModelName })}`; // Get export const layoutNamesPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-names`; // Get export const layoutSetsPath = (org, app) => `${basePath}/${org}/${app}/app-development/layout-sets`; // Get export const layoutSetPath = (org, app, layoutSetIdToUpdate) => `${basePath}/${org}/${app}/app-development/layout-set/${layoutSetIdToUpdate}`; // Put, Delete From 3a35342c8e03b9660b6f38f51ba9211362f6d422 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 09:06:16 +0200 Subject: [PATCH 10/26] Fix 404 test --- .../GetModelMetadataTests.cs | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 3abe7dcf678..1ad4302a921 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -87,29 +87,15 @@ public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNam } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet3")] - [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null)] - public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromLayoutSetParam(string org, string app, string developer, string layoutSetName) + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet3", null)] + [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null, null)] + [InlineData("ttd", "app-with-layoutsets", "testUser", null, "non-existing-dataModelName")] + public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datamodel_Exists(string org, string app, string developer, string layoutSetName, string dataModelName) { string targetRepository = TestDataHelper.GenerateTestRepoName(); await CopyRepositoryForTest(org, app, developer, targetRepository); - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); - - using var response = await HttpClient.SendAsync(httpRequestMessage); - response.StatusCode.Should().Be(HttpStatusCode.NotFound); - } - - [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "datamodel3")] - [InlineData("ttd", "app-without-layoutsets-mismatch-modelname", "testUser", null)] - public async Task GetModelMetadata_Should_Return_404_When_No_Datamodel_Exists_FromDataModelNameParam(string org, string app, string developer, string dataModelName) - { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?dataModelName={dataModelName}"; + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); using var response = await HttpClient.SendAsync(httpRequestMessage); From 1882a3c5008ce13f50bd9fdb3ab86beb593de5a4 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 10:28:57 +0200 Subject: [PATCH 11/26] Refactor arrange part of tests into a separate method --- .../GetModelMetadataTests.cs | 81 ++++++++----------- 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 1ad4302a921..93612ee004c 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -20,68 +20,39 @@ public GetModelMetadataTests(WebApplicationFactory factory) : base(fact } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null, "TestData/Model/Metadata/datamodel.json")] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, null, "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_IsNull(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null)] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, null)] + public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_Is_Undefined(string org, string app, string developer, string layoutSetName, string dataModelName) { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + // Arrange + (string url, string expectedModelMetadata) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + // Act using var response = await HttpClient.SendAsync(httpRequestMessage); - response.StatusCode.Should().Be(HttpStatusCode.OK); - string responseContent = await response.Content.ReadAsStringAsync(); - responseContent.Should().Be(expectedModelMetadata); - JsonUtils.DeepEquals(expectedModelMetadata, responseContent).Should().BeTrue(); - } - - [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", "datamodel", "TestData/Model/Metadata/datamodel.json")] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_IsSpecified(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) - { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; - - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); - - using var response = await HttpClient.SendAsync(httpRequestMessage); + // Assert response.StatusCode.Should().Be(HttpStatusCode.OK); - - string responseContent = await response.Content.ReadAsStringAsync(); - responseContent.Should().Be(expectedModelMetadata); JsonUtils.DeepEquals(expectedModelMetadata, responseContent).Should().BeTrue(); } [Theory] - [InlineData("ttd", "app-with-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel", "TestData/Model/Metadata/datamodel.json")] - public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNameParam(string org, string app, string developer, string layoutSetName, string dataModelName, string expectedModelMetadataPath) + [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", "datamodel")] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, "datamodel")] + public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_Is_Specified(string org, string app, string developer, string layoutSetName, string dataModelName) { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); - - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; - + // Arrange + (string url, string expectedModelMetadata) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + // Act using var response = await HttpClient.SendAsync(httpRequestMessage); - response.StatusCode.Should().Be(HttpStatusCode.OK); - string responseContent = await response.Content.ReadAsStringAsync(); + // Assert + response.StatusCode.Should().Be(HttpStatusCode.OK); responseContent.Should().Be(expectedModelMetadata); JsonUtils.DeepEquals(expectedModelMetadata, responseContent).Should().BeTrue(); } @@ -92,13 +63,14 @@ public async Task GetModelMetadata_Should_Return_ModelMetadata_From_DataModelNam [InlineData("ttd", "app-with-layoutsets", "testUser", null, "non-existing-dataModelName")] public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datamodel_Exists(string org, string app, string developer, string layoutSetName, string dataModelName) { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + // Arrange + (string url, _) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + // Act using var response = await HttpClient.SendAsync(httpRequestMessage); + + // Assert response.StatusCode.Should().Be(HttpStatusCode.NotFound); } @@ -109,5 +81,18 @@ private async Task AddModelMetadataToRepo(string createdFolderPath, stri await File.WriteAllTextAsync(filePath, modelMetadata); return modelMetadata; } + + private async Task<(string url, string expectedModelMetadata)> ArrangeGetModelMetadataTest(string org, string app, string developer, string layoutSetName, string dataModelName) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + + const string expectedModelMetadataPath = "TestData/Model/Metadata/datamodel.json"; + string expectedModelMetadata = await AddModelMetadataToRepo(TestRepoPath, expectedModelMetadataPath); + + string url = $"{VersionPrefix(org, targetRepository)}/model-metadata?layoutSetName={layoutSetName}&dataModelName={dataModelName}"; + + return (url, expectedModelMetadata); + } } } From f49613f7268e6270e5ba0afe1b69076ba568cd1f Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 13:16:05 +0200 Subject: [PATCH 12/26] Write test GetModelMetadata_Should_Return_Empty_Metadata_Object_When_DataTypeId_Is_NonExisting --- .../Controllers/AppDevelopmentController.cs | 1 - .../Implementation/AppDevelopmentService.cs | 1 + .../GetModelMetadataTests.cs | 20 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index 78ab337fdb2..4b983a0e797 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -12,7 +12,6 @@ using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Models.Dto; using Altinn.Studio.Designer.Services.Interfaces; -using JetBrains.Annotations; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 35d32bca149..497fa4ade15 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -209,6 +209,7 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin // get task_id since we might not maintain dataType ref in layout-sets-file string taskId = await GetTaskIdBasedOnLayoutSet(altinnRepoEditingContext, layoutSetName, cancellationToken); string modelName = GetModelName(applicationMetadata, taskId); + if (string.IsNullOrEmpty(modelName)) { return new ModelMetadata(); diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 93612ee004c..beb39af48c8 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; +using Altinn.Studio.DataModeling.Metamodel; using Designer.Tests.Controllers.ApiTests; using Designer.Tests.Utils; using FluentAssertions; @@ -74,6 +75,25 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam response.StatusCode.Should().Be(HttpStatusCode.NotFound); } + [Theory] + [InlineData("ttd", "app-without-layoutsets", "testUser", null, null)] + public async Task GetModelMetadata_Should_Return_Empty_Metadata_Object_When_DataTypeId_Is_NonExisting(string org, string app, string developer, string layoutSetName, string dataModelName) + { + // Arrange + (string url, _) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); + using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); + + // Act + using var response = await HttpClient.SendAsync(httpRequestMessage); + ModelMetadata responseContent = await response.Content.ReadAsAsync(); + + // Assert + response.StatusCode.Should().Be(HttpStatusCode.OK); + Assert.Null(responseContent.Org); + Assert.Null(responseContent.ServiceName); + Assert.Null(responseContent.RepositoryName); + } + private async Task AddModelMetadataToRepo(string createdFolderPath, string expectedModelMetadataPath) { string modelMetadata = SharedResourcesHelper.LoadTestDataAsString(expectedModelMetadataPath); From 17c6ddf30906e7ced7f976f254ff9722b6922f57 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 13:51:33 +0200 Subject: [PATCH 13/26] Update code comments --- backend/src/Designer/Controllers/AppDevelopmentController.cs | 2 +- .../src/Designer/Services/Interfaces/IAppDevelopmentService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index 4b983a0e797..d0f33199e96 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -271,7 +271,7 @@ public async Task GetAppMetadataDataModelIds(string org, string a /// Unique identifier of the organisation responsible for the app. /// Application identifier which is unique within an organisation. /// Name of current layoutSet in ux-editor that edited layout belongs to - /// Name of data model to fetch (optional) + /// Name of data model to fetch /// An that observes if operation is cancelled. /// The model as JSON [HttpGet] diff --git a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs index 2d1c6f299c0..db9504e2fd9 100644 --- a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs +++ b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs @@ -92,7 +92,7 @@ public Task> GetAppMetadataModelIds( /// /// An . /// Name of layoutSet to fetch corresponding model metadata for - /// modelMetaData to fetch + /// Name of data model to fetch /// An that observes if operation is cancelled. /// The model metadata for a given layout set. public Task GetModelMetadata( From 20b9eff09da5787a52bdde998bfbc76a3ee6375a Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 14:04:33 +0200 Subject: [PATCH 14/26] Add 'null' value for dataModelName where it is used in frontend code --- frontend/packages/ux-editor-v3/src/App.tsx | 2 +- .../src/components/config/EditFormComponent.test.tsx | 4 ++-- .../ux-editor-v3/src/components/config/EditFormContainer.tsx | 2 +- .../ExpressionEditMode/SimpleExpression/DataSourceValue.tsx | 2 +- .../src/components/config/SelectDataModelComponent.test.tsx | 4 ++-- .../src/components/config/SelectDataModelComponent.tsx | 2 +- .../components/config/editModal/EditDataModelBindings.tsx | 2 +- .../src/hooks/queries/useDatamodelMetadataQuery.ts | 5 +++-- frontend/packages/ux-editor/src/App.tsx | 2 +- .../src/components/config/EditFormComponent.test.tsx | 2 +- .../config/ExpressionContent/ExpressionContent.tsx | 1 + .../src/components/config/SelectDataModelComponent.tsx | 2 +- .../EditDataModelBindings/EditDataModelBindings.tsx | 2 +- .../ux-editor/src/hooks/queries/useDatamodelMetadataQuery.ts | 5 +++-- 14 files changed, 20 insertions(+), 17 deletions(-) diff --git a/frontend/packages/ux-editor-v3/src/App.tsx b/frontend/packages/ux-editor-v3/src/App.tsx index 11a0ebd7e72..508a52cb308 100644 --- a/frontend/packages/ux-editor-v3/src/App.tsx +++ b/frontend/packages/ux-editor-v3/src/App.tsx @@ -27,7 +27,7 @@ export function App() { const { data: layoutSets, isSuccess: areLayoutSetsFetched } = useLayoutSetsQuery(org, app); const { isSuccess: areWidgetsFetched, isError: widgetFetchedError } = useWidgetsQuery(org, app); const { isSuccess: isDatamodelFetched, isError: dataModelFetchedError } = - useDatamodelMetadataQuery(org, app, selectedLayoutSet); + useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); const { isSuccess: areTextResourcesFetched } = useTextResourcesQuery(org, app); useEffect(() => { diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx index 9e20ec5614d..7e463fad29a 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx @@ -224,8 +224,8 @@ const waitForData = async () => { const dataModelMetadataResult = renderHookWithMockStore( {}, { getDatamodelMetadata }, - )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set')).renderHookResult - .result; + )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null)) + .renderHookResult.result; await waitFor(() => expect(dataModelMetadataResult.current.isSuccess).toBe(true)); await waitFor(() => expect(layoutSchemaResult.current[0].isSuccess).toBe(true)); }; diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx index 6ac25b0d67f..dbb426470fa 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx @@ -46,7 +46,7 @@ export const EditFormContainer = ({ const { selectedLayoutSet } = useAppContext(); const { data: formLayouts } = useFormLayoutsQuery(org, app, selectedLayoutSet); - const { data: dataModel } = useDatamodelMetadataQuery(org, app, selectedLayoutSet); + const { data: dataModel } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); const { components, containers } = useSelectedFormLayout(); const textResources: ITextResource[] = useTextResourcesSelector( textResourcesByLanguageSelector(DEFAULT_LANGUAGE), diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx index fd9657d9bb5..86b43f97b4a 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx @@ -34,7 +34,7 @@ export const DataSourceValue = ({ const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); // TODO: Show spinner when isLoading - const datamodelQuery = useDatamodelMetadataQuery(org, app, selectedLayoutSet); + const datamodelQuery = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); const { data: formLayoutsData } = useFormLayoutsQuery(org, app, selectedLayoutSet); const t = useText(); diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx index 30b07dd9e1d..b7fb485a396 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx @@ -58,8 +58,8 @@ const waitForData = async () => { { getDatamodelMetadata, }, - )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set')).renderHookResult - .result; + )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null)) + .renderHookResult.result; await waitFor(() => expect(datamodelMetadatResult.current.isSuccess).toBe(true)); }; diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx index 78944462fb7..1ad8a4e949c 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx @@ -32,7 +32,7 @@ export const SelectDataModelComponent = ({ }: ISelectDataModelProps) => { const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet); + const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); const [dataModelElementNames, setDataModelElementNames] = React.useState([]); useEffect(() => { diff --git a/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx b/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx index 5bb9f97d77f..8ea22a1cf6e 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx @@ -30,7 +30,7 @@ export const EditDataModelBindings = ({ }: EditDataModelBindingsProps) => { const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet); + const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); const t = useText(); const handleDataModelChange = (selectedDataModelElement: string, key = 'simpleBinding') => { diff --git a/frontend/packages/ux-editor-v3/src/hooks/queries/useDatamodelMetadataQuery.ts b/frontend/packages/ux-editor-v3/src/hooks/queries/useDatamodelMetadataQuery.ts index 19f11f81ed1..937768c3c8b 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/queries/useDatamodelMetadataQuery.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/queries/useDatamodelMetadataQuery.ts @@ -8,12 +8,13 @@ export const useDatamodelMetadataQuery = ( org: string, app: string, layoutSetName: string, + dataModelName: string, ): UseQueryResult => { const { getDatamodelMetadata } = useServicesContext(); return useQuery({ - queryKey: [QueryKey.DatamodelMetadata, org, app, layoutSetName], + queryKey: [QueryKey.DatamodelMetadata, org, app, layoutSetName, dataModelName], queryFn: () => - getDatamodelMetadata(org, app, layoutSetName).then((res) => { + getDatamodelMetadata(org, app, layoutSetName, dataModelName).then((res) => { const dataModelFields: DatamodelFieldElement[] = []; Object.keys(res.elements).forEach((dataModelField) => { if (dataModelField) { diff --git a/frontend/packages/ux-editor/src/App.tsx b/frontend/packages/ux-editor/src/App.tsx index 464fdd941bc..589d2ec4be4 100644 --- a/frontend/packages/ux-editor/src/App.tsx +++ b/frontend/packages/ux-editor/src/App.tsx @@ -21,7 +21,7 @@ export function App() { const { selectedFormLayoutSetName } = useAppContext(); const { isSuccess: areWidgetsFetched, isError: widgetFetchedError } = useWidgetsQuery(org, app); const { isSuccess: isDatamodelFetched, isError: dataModelFetchedError } = - useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName); + useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); const { isSuccess: areTextResourcesFetched } = useTextResourcesQuery(org, app); const componentIsReady = areWidgetsFetched && isDatamodelFetched && areTextResourcesFetched; diff --git a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx index e4865c66f9c..a072bcf71b8 100644 --- a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx @@ -98,7 +98,7 @@ const waitForData = async () => { const layoutSchemaResult = renderHookWithProviders(() => useLayoutSchemaQuery()).result; await waitFor(() => expect(layoutSchemaResult.current[0].isSuccess).toBe(true)); const dataModelMetadataResult = renderHookWithProviders( - () => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set'), + () => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null), { queries: { getDatamodelMetadata } }, ).result; await waitFor(() => expect(dataModelMetadataResult.current.isSuccess).toBe(true)); diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx index 39f24ece1f2..05b95e4c411 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx @@ -32,6 +32,7 @@ export const ExpressionContent = ({ org, app, selectedFormLayoutSetName, + null, ); const dataLookupOptions: DataLookupOptions = useMemo( diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx index 111a5cdfaf1..9848addb8db 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx @@ -33,7 +33,7 @@ export const SelectDataModelComponent = ({ }: ISelectDataModelProps) => { const { org, app } = useStudioUrlParams(); const { selectedFormLayoutSetName } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName); + const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); const [dataModelElementNames, setDataModelElementNames] = React.useState([]); useEffect(() => { diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx index 1f8127fdc26..80ea0013a40 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx @@ -35,7 +35,7 @@ export const EditDataModelBindings = ({ }: EditDataModelBindingsProps) => { const { org, app } = useStudioUrlParams(); const { selectedFormLayoutSetName } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName); + const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); const { t } = useTranslation(); const [dataModelSelectVisible, setDataModelSelectVisible] = useState(false); diff --git a/frontend/packages/ux-editor/src/hooks/queries/useDatamodelMetadataQuery.ts b/frontend/packages/ux-editor/src/hooks/queries/useDatamodelMetadataQuery.ts index 8f5c841415a..f7bf48efe6d 100644 --- a/frontend/packages/ux-editor/src/hooks/queries/useDatamodelMetadataQuery.ts +++ b/frontend/packages/ux-editor/src/hooks/queries/useDatamodelMetadataQuery.ts @@ -8,12 +8,13 @@ export const useDatamodelMetadataQuery = ( org: string, app: string, layoutSetName: string, + dataModelName: string, ): UseQueryResult => { const { getDatamodelMetadata } = useServicesContext(); return useQuery({ - queryKey: [QueryKey.DatamodelMetadata, org, app, layoutSetName], + queryKey: [QueryKey.DatamodelMetadata, org, app, layoutSetName, dataModelName], queryFn: () => - getDatamodelMetadata(org, app, layoutSetName).then((res) => { + getDatamodelMetadata(org, app, layoutSetName, dataModelName).then((res) => { const dataModelFields: DatamodelFieldElement[] = []; // Hack because we don't know if the response is upper or lower cased. Should be reverted once From 462e74a7c0d3a4dd640ea9a0dcb60c1f72d5a31a Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 21 May 2024 14:59:53 +0200 Subject: [PATCH 15/26] Add dataModelName param to datamodelMetadataPath --- frontend/packages/shared/src/api/queries.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/packages/shared/src/api/queries.ts b/frontend/packages/shared/src/api/queries.ts index 2f7fe759143..d877b66c193 100644 --- a/frontend/packages/shared/src/api/queries.ts +++ b/frontend/packages/shared/src/api/queries.ts @@ -79,7 +79,7 @@ export const getAppReleases = (owner: string, app: string) => get get(appVersionPath(org, app)); export const getBranchStatus = (owner: string, app: string, branch: string) => get(branchStatusPath(owner, app, branch)); export const getDatamodel = (owner: string, app: string, modelPath: string) => get(datamodelPath(owner, app, modelPath)); -export const getDatamodelMetadata = (owner: string, app: string, layoutSetName: string) => get(datamodelMetadataPath(owner, app, layoutSetName)); +export const getDatamodelMetadata = (owner: string, app: string, layoutSetName: string, dataModelName: string) => get(datamodelMetadataPath(owner, app, layoutSetName, dataModelName)); export const getDatamodelsJson = (owner: string, app: string) => get(datamodelsPath(owner, app)); export const getDatamodelsXsd = (owner: string, app: string) => get(datamodelsXsdPath(owner, app)); export const getDeployPermissions = (owner: string, app: string) => get(deployPermissionsPath(owner, app)); From b058e245619cba6bb84d3a68882260a3989d0caa Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Wed, 22 May 2024 10:35:22 +0200 Subject: [PATCH 16/26] Add null parameter for dataModelName for all tests --- .../PageConfigPanel/HiddenExpressionOnLayout.test.tsx | 6 +++++- .../Properties/PageConfigPanel/PageConfigPanel.test.tsx | 6 +++++- .../config/ExpressionContent/ExpressionContent.test.tsx | 6 +++++- .../components/config/Expressions/Expressions.test.tsx | 8 ++++++-- .../components/config/SelectDataModelComponent.test.tsx | 2 +- .../EditDataModelBindings/EditDataModelBindings.test.tsx | 2 +- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx index 4cec0d795b6..1f29b5efa45 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx @@ -116,7 +116,11 @@ describe('HiddenExpressionOnLayout', () => { }); const renderHiddenExpressionOnLayout = (layouts = defaultLayouts) => { + const dataModelName = null; queryClientMock.setQueryData([QueryKey.FormLayouts, org, app, layoutSet], layouts); - queryClientMock.setQueryData([QueryKey.DatamodelMetadata, org, app, layoutSet], []); + queryClientMock.setQueryData( + [QueryKey.DatamodelMetadata, org, app, layoutSet, dataModelName], + [], + ); return renderWithProviders(); }; diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx index 2311cac453d..9a08927c8d2 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx @@ -92,9 +92,13 @@ const renderPageConfigPanel = ( selectedLayoutName: string = DEFAULT_SELECTED_LAYOUT_NAME, textResources = defaultTexts, ) => { + const dataModelName = null; queryClientMock.setQueryData([QueryKey.TextResources, org, app], textResources); queryClientMock.setQueryData([QueryKey.FormLayouts, org, app, layoutSet], layouts); - queryClientMock.setQueryData([QueryKey.DatamodelMetadata, org, app, layoutSet], []); + queryClientMock.setQueryData( + [QueryKey.DatamodelMetadata, org, app, layoutSet, dataModelName], + [], + ); return renderWithProviders(, { appContextProps: { selectedFormLayoutName: selectedLayoutName }, diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx index 550a9db73a9..b665b32e09f 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx @@ -68,9 +68,13 @@ describe('ExpressionContent', () => { const renderExpressionContent = (props: Partial = {}) => { const appContextProps: Partial = { selectedFormLayoutSetName: layoutSetName }; + const dataModelName = null; const queryClient = createQueryClientMock(); queryClient.setQueryData([QueryKey.FormLayouts, org, app, layoutSetName], layouts); - queryClient.setQueryData([QueryKey.DatamodelMetadata, org, app, layoutSetName], []); + queryClient.setQueryData( + [QueryKey.DatamodelMetadata, org, app, layoutSetName, dataModelName], + [], + ); return renderWithProviders(, { appContextProps, diff --git a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx index 5d340abd297..cc1b605e7ef 100644 --- a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx @@ -56,7 +56,7 @@ describe('Expressions', () => { screen.getByRole('button', { name: textMock('right_menu.expressions_add') }); }); - it('renders the expression and the button for adding an expression when th hidden field on the component has an expression', () => { + it('renders the expression and the button for adding an expression when the hidden field on the component has an expression', () => { renderExpressions(); const expressionName = textMock('right_menu.expressions_property_preview_hidden'); screen.getByRole('group', { name: expressionName }); @@ -173,9 +173,13 @@ describe('Expressions', () => { const renderExpressions = (formItemContext: Partial = {}) => { const appContextProps: Partial = { selectedFormLayoutSetName: layoutSetName }; + const dataModelName = null; const queryClient = createQueryClientMock(); queryClient.setQueryData([QueryKey.FormLayouts, org, app, layoutSetName], layouts); - queryClient.setQueryData([QueryKey.DatamodelMetadata, org, app, layoutSetName], []); + queryClient.setQueryData( + [QueryKey.DatamodelMetadata, org, app, layoutSetName, dataModelName], + [], + ); return renderWithProviders( diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx index 4c6420753bf..3fbc5f49a49 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx @@ -67,7 +67,7 @@ const render = async ({ handleComponentChange = jest.fn(), } = {}) => { queryClientMock.setQueryData( - [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set'], + [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', null], dataModelMetadata, ); renderWithProviders( diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx index e06af8d96f7..3781f2c038d 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx @@ -303,7 +303,7 @@ describe('EditDataModelBindings', () => { const dataBindingNameMock = 'element'; const maxCountMock = 2; queryClientMock.setQueryData( - [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set'], + [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', null], [{ dataBindingName: dataBindingNameMock, maxOccurs: maxCountMock }], ); render({ From 088c60e1e0ca341dea2a9430d79336613f853730 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Wed, 22 May 2024 10:53:44 +0200 Subject: [PATCH 17/26] Remove redundant test case --- .../GetModelMetadataTests.cs | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index beb39af48c8..93612ee004c 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -2,7 +2,6 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; -using Altinn.Studio.DataModeling.Metamodel; using Designer.Tests.Controllers.ApiTests; using Designer.Tests.Utils; using FluentAssertions; @@ -75,25 +74,6 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam response.StatusCode.Should().Be(HttpStatusCode.NotFound); } - [Theory] - [InlineData("ttd", "app-without-layoutsets", "testUser", null, null)] - public async Task GetModelMetadata_Should_Return_Empty_Metadata_Object_When_DataTypeId_Is_NonExisting(string org, string app, string developer, string layoutSetName, string dataModelName) - { - // Arrange - (string url, _) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); - - // Act - using var response = await HttpClient.SendAsync(httpRequestMessage); - ModelMetadata responseContent = await response.Content.ReadAsAsync(); - - // Assert - response.StatusCode.Should().Be(HttpStatusCode.OK); - Assert.Null(responseContent.Org); - Assert.Null(responseContent.ServiceName); - Assert.Null(responseContent.RepositoryName); - } - private async Task AddModelMetadataToRepo(string createdFolderPath, string expectedModelMetadataPath) { string modelMetadata = SharedResourcesHelper.LoadTestDataAsString(expectedModelMetadataPath); From 388b31b7249ceb2e8856f31db56ff99c03f1e63e Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Fri, 24 May 2024 08:31:49 +0200 Subject: [PATCH 18/26] Make dataModelNames into 'undefined' instead of 'null', and into 'test-data-model' where applicable --- .../Designer/Services/Interfaces/IAppDevelopmentService.cs | 4 ++-- .../AppDevelopmentController/GetModelMetadataTests.cs | 2 +- frontend/packages/ux-editor-v3/src/App.tsx | 2 +- .../ux-editor-v3/src/components/config/EditFormContainer.tsx | 2 +- .../ExpressionEditMode/SimpleExpression/DataSourceValue.tsx | 2 +- .../src/components/config/SelectDataModelComponent.tsx | 2 +- .../src/components/config/editModal/EditDataModelBindings.tsx | 2 +- frontend/packages/ux-editor/src/App.tsx | 2 +- .../PageConfigPanel/HiddenExpressionOnLayout.test.tsx | 2 +- .../Properties/PageConfigPanel/PageConfigPanel.test.tsx | 2 +- .../src/components/config/EditFormComponent.test.tsx | 2 +- .../config/ExpressionContent/ExpressionContent.test.tsx | 2 +- .../components/config/ExpressionContent/ExpressionContent.tsx | 2 +- .../src/components/config/Expressions/Expressions.test.tsx | 2 +- .../src/components/config/SelectDataModelComponent.test.tsx | 3 +-- .../src/components/config/SelectDataModelComponent.tsx | 2 +- .../EditDataModelBindings/EditDataModelBindings.test.tsx | 2 +- .../editModal/EditDataModelBindings/EditDataModelBindings.tsx | 2 +- .../packages/ux-editor/src/containers/FormDesigner.test.tsx | 3 +-- 19 files changed, 20 insertions(+), 22 deletions(-) diff --git a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs index db9504e2fd9..42556e4eaa3 100644 --- a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs +++ b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs @@ -92,11 +92,11 @@ public Task> GetAppMetadataModelIds( /// /// An . /// Name of layoutSet to fetch corresponding model metadata for - /// Name of data model to fetch + /// Name of data model to fetch /// An that observes if operation is cancelled. /// The model metadata for a given layout set. public Task GetModelMetadata( - AltinnRepoEditingContext altinnRepoEditingContext, [CanBeNull] string layoutSetName, [CanBeNull] string modelMetaData, + AltinnRepoEditingContext altinnRepoEditingContext, [CanBeNull] string layoutSetName, [CanBeNull] string dataModelName, CancellationToken cancellationToken = default); /// diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index 93612ee004c..f39caac9664 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -22,7 +22,7 @@ public GetModelMetadataTests(WebApplicationFactory factory) : base(fact [Theory] [InlineData("ttd", "app-with-layoutsets", "testUser", "layoutSet1", null)] [InlineData("ttd", "app-without-layoutsets", "testUser", null, null)] - public async Task GetModelMetadata_Should_Return_ModelMetadata_When_DataModelName_Is_Undefined(string org, string app, string developer, string layoutSetName, string dataModelName) + public async Task GetModelMetadata_Should_Return_ModelMetadata_Based_On_LayoutSet_When_DataModelName_Is_Undefined(string org, string app, string developer, string layoutSetName, string dataModelName) { // Arrange (string url, string expectedModelMetadata) = await ArrangeGetModelMetadataTest(org, app, developer, layoutSetName, dataModelName); diff --git a/frontend/packages/ux-editor-v3/src/App.tsx b/frontend/packages/ux-editor-v3/src/App.tsx index 508a52cb308..fc045b26527 100644 --- a/frontend/packages/ux-editor-v3/src/App.tsx +++ b/frontend/packages/ux-editor-v3/src/App.tsx @@ -27,7 +27,7 @@ export function App() { const { data: layoutSets, isSuccess: areLayoutSetsFetched } = useLayoutSetsQuery(org, app); const { isSuccess: areWidgetsFetched, isError: widgetFetchedError } = useWidgetsQuery(org, app); const { isSuccess: isDatamodelFetched, isError: dataModelFetchedError } = - useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); + useDatamodelMetadataQuery(org, app, selectedLayoutSet, undefined); const { isSuccess: areTextResourcesFetched } = useTextResourcesQuery(org, app); useEffect(() => { diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx index dbb426470fa..9c28a3f4efa 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.tsx @@ -46,7 +46,7 @@ export const EditFormContainer = ({ const { selectedLayoutSet } = useAppContext(); const { data: formLayouts } = useFormLayoutsQuery(org, app, selectedLayoutSet); - const { data: dataModel } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); + const { data: dataModel } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, undefined); const { components, containers } = useSelectedFormLayout(); const textResources: ITextResource[] = useTextResourcesSelector( textResourcesByLanguageSelector(DEFAULT_LANGUAGE), diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx index 86b43f97b4a..27977f5a334 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/DataSourceValue.tsx @@ -34,7 +34,7 @@ export const DataSourceValue = ({ const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); // TODO: Show spinner when isLoading - const datamodelQuery = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); + const datamodelQuery = useDatamodelMetadataQuery(org, app, selectedLayoutSet, undefined); const { data: formLayoutsData } = useFormLayoutsQuery(org, app, selectedLayoutSet); const t = useText(); diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx index 1ad8a4e949c..063b2856f35 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.tsx @@ -32,7 +32,7 @@ export const SelectDataModelComponent = ({ }: ISelectDataModelProps) => { const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); + const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, undefined); const [dataModelElementNames, setDataModelElementNames] = React.useState([]); useEffect(() => { diff --git a/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx b/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx index 8ea22a1cf6e..667bd91da3a 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/editModal/EditDataModelBindings.tsx @@ -30,7 +30,7 @@ export const EditDataModelBindings = ({ }: EditDataModelBindingsProps) => { const { org, app } = useStudioUrlParams(); const { selectedLayoutSet } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, null); + const { data } = useDatamodelMetadataQuery(org, app, selectedLayoutSet, undefined); const t = useText(); const handleDataModelChange = (selectedDataModelElement: string, key = 'simpleBinding') => { diff --git a/frontend/packages/ux-editor/src/App.tsx b/frontend/packages/ux-editor/src/App.tsx index 589d2ec4be4..033a322de39 100644 --- a/frontend/packages/ux-editor/src/App.tsx +++ b/frontend/packages/ux-editor/src/App.tsx @@ -21,7 +21,7 @@ export function App() { const { selectedFormLayoutSetName } = useAppContext(); const { isSuccess: areWidgetsFetched, isError: widgetFetchedError } = useWidgetsQuery(org, app); const { isSuccess: isDatamodelFetched, isError: dataModelFetchedError } = - useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); + useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, undefined); const { isSuccess: areTextResourcesFetched } = useTextResourcesQuery(org, app); const componentIsReady = areWidgetsFetched && isDatamodelFetched && areTextResourcesFetched; diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx index 1f29b5efa45..5bccf943018 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx @@ -16,6 +16,7 @@ import { queriesMock } from 'app-shared/mocks/queriesMock'; const app = 'app'; const org = 'org'; const layoutSet = layoutSetsMock.sets[0].id; +const dataModelName = undefined; const defaultLayouts: IFormLayouts = { [layout1NameMock]: layoutMock, @@ -116,7 +117,6 @@ describe('HiddenExpressionOnLayout', () => { }); const renderHiddenExpressionOnLayout = (layouts = defaultLayouts) => { - const dataModelName = null; queryClientMock.setQueryData([QueryKey.FormLayouts, org, app, layoutSet], layouts); queryClientMock.setQueryData( [QueryKey.DatamodelMetadata, org, app, layoutSet, dataModelName], diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx index 9a08927c8d2..8f8e00e6588 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx @@ -15,6 +15,7 @@ const app = 'app'; const org = 'org'; const layoutSet = layoutSetsMock.sets[0].id; const duplicatedLayout = 'duplicatedLayout'; +const dataModelName = undefined; const defaultTexts: ITextResources = { [DEFAULT_LANGUAGE]: [ @@ -92,7 +93,6 @@ const renderPageConfigPanel = ( selectedLayoutName: string = DEFAULT_SELECTED_LAYOUT_NAME, textResources = defaultTexts, ) => { - const dataModelName = null; queryClientMock.setQueryData([QueryKey.TextResources, org, app], textResources); queryClientMock.setQueryData([QueryKey.FormLayouts, org, app, layoutSet], layouts); queryClientMock.setQueryData( diff --git a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx index a072bcf71b8..0e310b74017 100644 --- a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx @@ -98,7 +98,7 @@ const waitForData = async () => { const layoutSchemaResult = renderHookWithProviders(() => useLayoutSchemaQuery()).result; await waitFor(() => expect(layoutSchemaResult.current[0].isSuccess).toBe(true)); const dataModelMetadataResult = renderHookWithProviders( - () => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null), + () => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', 'test-data-model'), { queries: { getDatamodelMetadata } }, ).result; await waitFor(() => expect(dataModelMetadataResult.current.isSuccess).toBe(true)); diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx index b665b32e09f..9674e2c8efa 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx @@ -20,6 +20,7 @@ const layoutSetName = layoutSetsMock.sets[0].id; const layouts: IFormLayouts = { [layout1NameMock]: layoutMock, }; +const dataModelName = undefined; const heading = 'Test'; const defaultProps: ExpressionContentProps = { expression: null, @@ -68,7 +69,6 @@ describe('ExpressionContent', () => { const renderExpressionContent = (props: Partial = {}) => { const appContextProps: Partial = { selectedFormLayoutSetName: layoutSetName }; - const dataModelName = null; const queryClient = createQueryClientMock(); queryClient.setQueryData([QueryKey.FormLayouts, org, app, layoutSetName], layouts); queryClient.setQueryData( diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx index ee403b5a65e..c01e6e1c9c4 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.tsx @@ -32,7 +32,7 @@ export const ExpressionContent = ({ org, app, selectedFormLayoutSetName, - null, + undefined, ); const dataLookupOptions: Partial = useMemo( () => ({ diff --git a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx index cc1b605e7ef..98c7525c9a3 100644 --- a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx @@ -24,6 +24,7 @@ const layoutSetName = layoutSetsMock.sets[0].id; const layouts: IFormLayouts = { [layout1NameMock]: layoutMock, }; +const dataModelName = undefined; const componentWithExpression: FormComponent = { id: 'some-id', type: ComponentType.Input, @@ -173,7 +174,6 @@ describe('Expressions', () => { const renderExpressions = (formItemContext: Partial = {}) => { const appContextProps: Partial = { selectedFormLayoutSetName: layoutSetName }; - const dataModelName = null; const queryClient = createQueryClientMock(); queryClient.setQueryData([QueryKey.FormLayouts, org, app, layoutSetName], layouts); queryClient.setQueryData( diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx index b1cda0c665b..e84c468a3f9 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx @@ -66,9 +66,8 @@ const render = async ({ label = undefined, handleComponentChange = jest.fn(), } = {}) => { - const dataModelName = null; queryClientMock.setQueryData( - [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', dataModelName], + [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', 'test-data-model'], dataModelMetadata, ); renderWithProviders( diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx index 9848addb8db..225cda70e40 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.tsx @@ -33,7 +33,7 @@ export const SelectDataModelComponent = ({ }: ISelectDataModelProps) => { const { org, app } = useStudioUrlParams(); const { selectedFormLayoutSetName } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); + const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, undefined); const [dataModelElementNames, setDataModelElementNames] = React.useState([]); useEffect(() => { diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx index 3781f2c038d..5f794ed10d4 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx @@ -303,7 +303,7 @@ describe('EditDataModelBindings', () => { const dataBindingNameMock = 'element'; const maxCountMock = 2; queryClientMock.setQueryData( - [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', null], + [QueryKey.DatamodelMetadata, 'org', 'app', 'test-layout-set', 'test-data-model'], [{ dataBindingName: dataBindingNameMock, maxOccurs: maxCountMock }], ); render({ diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx index 80ea0013a40..ba3c6f76750 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.tsx @@ -35,7 +35,7 @@ export const EditDataModelBindings = ({ }: EditDataModelBindingsProps) => { const { org, app } = useStudioUrlParams(); const { selectedFormLayoutSetName } = useAppContext(); - const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, null); + const { data } = useDatamodelMetadataQuery(org, app, selectedFormLayoutSetName, undefined); const { t } = useTranslation(); const [dataModelSelectVisible, setDataModelSelectVisible] = useState(false); diff --git a/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx b/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx index f7e203aed7e..eea3ef17352 100644 --- a/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx +++ b/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx @@ -28,7 +28,6 @@ const defaultTexts: ITextResources = { }; const render = () => { - const dataModelName = null; const queryClient = createQueryClientMock(); const queries = { getFormLayouts: jest.fn().mockImplementation(() => Promise.resolve(externalLayoutsMock)), @@ -39,7 +38,7 @@ const render = () => { getInstanceIdForPreview: jest.fn().mockImplementation(() => Promise.resolve('test')), }; queryClient.setQueryData( - [QueryKey.DatamodelMetadata, org, app, 'test-layout-set', dataModelName], + [QueryKey.DatamodelMetadata, org, app, 'test-layout-set', 'test-data-model'], [], ); queryClient.setQueryData([QueryKey.TextResources, org, app], defaultTexts); From 9b9ba7024fc0d962dbcfdc5039e04a70593a4430 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Fri, 24 May 2024 08:55:24 +0200 Subject: [PATCH 19/26] Add 'test-data-model' where missing --- .../src/components/config/EditFormComponent.test.tsx | 2 +- .../src/components/config/SelectDataModelComponent.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx index 7e463fad29a..572e793a9a7 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx @@ -224,7 +224,7 @@ const waitForData = async () => { const dataModelMetadataResult = renderHookWithMockStore( {}, { getDatamodelMetadata }, - )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null)) + )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', 'test-data-model')) .renderHookResult.result; await waitFor(() => expect(dataModelMetadataResult.current.isSuccess).toBe(true)); await waitFor(() => expect(layoutSchemaResult.current[0].isSuccess).toBe(true)); diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx index b7fb485a396..d85d3d4bd38 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx @@ -58,7 +58,7 @@ const waitForData = async () => { { getDatamodelMetadata, }, - )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', null)) + )(() => useDatamodelMetadataQuery('test-org', 'test-app', 'test-layout-set', 'test-data-model')) .renderHookResult.result; await waitFor(() => expect(datamodelMetadatResult.current.isSuccess).toBe(true)); }; From 1bbb1498020f84d56120208d1074aa650198875f Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Fri, 24 May 2024 12:17:34 +0200 Subject: [PATCH 20/26] Fix failing tests --- .../src/components/config/SelectDataModelComponent.test.tsx | 6 ++++-- .../packages/ux-editor/src/containers/FormDesigner.test.tsx | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx index 07c3cb00b06..c7edfd86cd7 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx @@ -9,7 +9,9 @@ import { getDataModelFieldsFilter } from '../../utils/datamodel'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { app, org } from '@studio/testing/testids'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; + +const dataModelName = undefined; const datamodelMetadataMock = [ { @@ -69,7 +71,7 @@ const render = async ({ handleComponentChange = jest.fn(), } = {}) => { queryClientMock.setQueryData( - [QueryKey.DatamodelMetadata, org, app, layoutSet1NameMock, dataModelNameMock], + [QueryKey.DatamodelMetadata, org, app, layoutSet1NameMock, dataModelName], dataModelMetadata, ); renderWithProviders( diff --git a/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx b/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx index fb813719da2..5ad2c098b64 100644 --- a/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx +++ b/frontend/packages/ux-editor/src/containers/FormDesigner.test.tsx @@ -24,6 +24,7 @@ import { app, org } from '@studio/testing/testids'; const defaultTexts: ITextResources = { [DEFAULT_LANGUAGE]: [], }; +const dataModelName = undefined; const render = () => { const queryClient = createQueryClientMock(); @@ -36,7 +37,7 @@ const render = () => { getInstanceIdForPreview: jest.fn().mockImplementation(() => Promise.resolve('test')), }; queryClient.setQueryData( - [QueryKey.DatamodelMetadata, org, app, 'test-layout-set', 'test-data-model'], + [QueryKey.DatamodelMetadata, org, app, 'test-layout-set', dataModelName], [], ); queryClient.setQueryData([QueryKey.TextResources, org, app], defaultTexts); From 582399beb1a2231b389d2d1ccbcecd87797103ba Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Mon, 27 May 2024 13:30:58 +0200 Subject: [PATCH 21/26] Add GetModelNameFromLayoutSet method and delete old code --- .../Controllers/AppDevelopmentController.cs | 1 + .../Implementation/AppDevelopmentService.cs | 42 +++++-------------- .../GetModelMetadataTests.cs | 1 + 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index d0f33199e96..a184d14d02a 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -281,6 +281,7 @@ public async Task GetModelMetadata(string org, string app, [FromQ { string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); ModelMetadata modelMetadata = await _appDevelopmentService.GetModelMetadata(AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer), layoutSetName, dataModelName, cancellationToken); + return Ok(modelMetadata); } diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 85ac88feb78..216052a4d50 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -12,11 +12,9 @@ using Altinn.Studio.Designer.Infrastructure.GitRepository; using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; -using JetBrains.Annotations; using Microsoft.AspNetCore.Http; using NuGet.Versioning; using LayoutSets = Altinn.Studio.Designer.Models.LayoutSets; -using PlatformStorageModels = Altinn.Platform.Storage.Interface.Models; namespace Altinn.Studio.Designer.Services.Implementation { @@ -193,22 +191,20 @@ public async Task> GetAppMetadataModelIds(AltinnRepoEditingC public async Task GetModelMetadata(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, string dataModelName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); - AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); - ApplicationMetadata applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(cancellationToken); string modelPath; ModelMetadata modelMetadata; - if (dataModelName != null) + // Get model metadata based on dataModelName if it is provided + if (dataModelName is not null) { modelPath = $"App/models/{dataModelName}.schema.json"; modelMetadata = await _schemaModelService.GenerateModelMetadataFromJsonSchema(altinnRepoEditingContext, modelPath, cancellationToken); return modelMetadata; } - // get task_id since we might not maintain dataType ref in layout-sets-file - string taskId = await GetTaskIdBasedOnLayoutSet(altinnRepoEditingContext, layoutSetName, cancellationToken); - string modelName = GetModelName(applicationMetadata, taskId); + // Get model metadata based on layoutSetName + string modelName = await GetModelNameFromLayoutSet(altinnRepoEditingContext, layoutSetName, cancellationToken); if (string.IsNullOrEmpty(modelName)) { @@ -220,18 +216,17 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin return modelMetadata; } - private string GetModelName(ApplicationMetadata applicationMetadata, [CanBeNull] string taskId) + private async Task GetModelNameFromLayoutSet(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) { - // fallback to first model if no task_id is provided (no layout sets) - if (taskId == null) + if (string.IsNullOrEmpty(layoutSetName)) { - return applicationMetadata.DataTypes.FirstOrDefault(data => data.AppLogic != null && !string.IsNullOrEmpty(data.AppLogic.ClassRef) && !string.IsNullOrEmpty(data.TaskId))?.Id ?? string.Empty; + return string.Empty; } - PlatformStorageModels.DataType data = applicationMetadata.DataTypes - .FirstOrDefault(data => data.AppLogic != null && DoesDataTaskMatchTaskId(data, taskId) && !string.IsNullOrEmpty(data.AppLogic.ClassRef)); + LayoutSets layoutSets = await GetLayoutSets(altinnRepoEditingContext, cancellationToken); + var layoutSetSearchResult = layoutSets.Sets.Find(set => set.Id == layoutSetName); - return data?.Id ?? string.Empty; + return layoutSetSearchResult.DataType; } private IEnumerable GetAppMetadataModelIds(ApplicationMetadata applicationMetadata, bool onlyUnReferenced) @@ -249,23 +244,6 @@ private IEnumerable GetAppMetadataModelIds(ApplicationMetadata applicati return appMetaDataDataTypes.Select(datatype => datatype.Id); } - private bool DoesDataTaskMatchTaskId(PlatformStorageModels.DataType data, [CanBeNull] string taskId) - { - return string.IsNullOrEmpty(taskId) || data.TaskId == taskId; - } - - private async Task GetTaskIdBasedOnLayoutSet(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) - { - if (string.IsNullOrEmpty(layoutSetName)) - { - // App without layout sets --> no need for task_id, we just retrieve the first occurence of a dataType with a classRef - return null; - } - LayoutSets layoutSets = await GetLayoutSets(altinnRepoEditingContext, cancellationToken); - - return layoutSets?.Sets?.Find(set => set.Id == layoutSetName)?.Tasks[0]; - } - /// public async Task GetLayoutSets(AltinnRepoEditingContext altinnRepoEditingContext, CancellationToken cancellationToken = default) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index f39caac9664..a72573a5e81 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -69,6 +69,7 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam // Act using var response = await HttpClient.SendAsync(httpRequestMessage); + var responseContent = await response.Content.ReadAsStringAsync(); // Assert response.StatusCode.Should().Be(HttpStatusCode.NotFound); From 6eeac5bccc2965babafd5950eb5f1ee561167f7f Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 28 May 2024 08:32:26 +0200 Subject: [PATCH 22/26] Add fallback to ApplicationMetadata in GetModelName --- .../Implementation/AppDevelopmentService.cs | 16 ++++++++-------- .../GetModelMetadataTests.cs | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 216052a4d50..1ab9c190517 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -191,11 +191,9 @@ public async Task> GetAppMetadataModelIds(AltinnRepoEditingC public async Task GetModelMetadata(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, string dataModelName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); - string modelPath; ModelMetadata modelMetadata; - // Get model metadata based on dataModelName if it is provided if (dataModelName is not null) { modelPath = $"App/models/{dataModelName}.schema.json"; @@ -203,8 +201,7 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin return modelMetadata; } - // Get model metadata based on layoutSetName - string modelName = await GetModelNameFromLayoutSet(altinnRepoEditingContext, layoutSetName, cancellationToken); + string modelName = await GetModelName(altinnRepoEditingContext, layoutSetName, cancellationToken); if (string.IsNullOrEmpty(modelName)) { @@ -216,17 +213,20 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin return modelMetadata; } - private async Task GetModelNameFromLayoutSet(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) + private async Task GetModelName(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(layoutSetName)) { - return string.Empty; + // Fallback to first model in app metadata if no layout set is provided + AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); + ApplicationMetadata applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(cancellationToken); + return applicationMetadata.DataTypes.FirstOrDefault(data => data.AppLogic != null && !string.IsNullOrEmpty(data.AppLogic.ClassRef) && !string.IsNullOrEmpty(data.TaskId))?.Id ?? string.Empty; } LayoutSets layoutSets = await GetLayoutSets(altinnRepoEditingContext, cancellationToken); - var layoutSetSearchResult = layoutSets.Sets.Find(set => set.Id == layoutSetName); + var foundLayoutSet = layoutSets.Sets.Find(set => set.Id == layoutSetName); - return layoutSetSearchResult.DataType; + return foundLayoutSet.DataType; } private IEnumerable GetAppMetadataModelIds(ApplicationMetadata applicationMetadata, bool onlyUnReferenced) diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs index a72573a5e81..f39caac9664 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetModelMetadataTests.cs @@ -69,7 +69,6 @@ public async Task GetModelMetadata_Should_Return_404_When_No_Corresponding_Datam // Act using var response = await HttpClient.SendAsync(httpRequestMessage); - var responseContent = await response.Content.ReadAsStringAsync(); // Assert response.StatusCode.Should().Be(HttpStatusCode.NotFound); From 3c8e0b97f757c8c9a31960f23524dc9213db90ef Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 28 May 2024 09:16:13 +0200 Subject: [PATCH 23/26] Dotnet format --- .../Designer/Services/Implementation/AppDevelopmentService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 1ab9c190517..92d9920413f 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -213,7 +213,7 @@ public async Task GetModelMetadata(AltinnRepoEditingContext altin return modelMetadata; } - private async Task GetModelName(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) + private async Task GetModelName(AltinnRepoEditingContext altinnRepoEditingContext, string layoutSetName, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(layoutSetName)) { From 39cf8d3b71f6892bfda9d67c27f84118c73af527 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 28 May 2024 12:06:03 +0200 Subject: [PATCH 24/26] Move layoutSetMocks into a new file --- .../src/components/AppPreviewSubMenu.test.tsx | 2 +- .../packages/ux-editor-v3/src/App.test.tsx | 2 +- .../Elements/LayoutSetsContainer.test.tsx | 6 +++++- .../config/EditFormComponent.test.tsx | 2 +- .../config/EditFormContainer.test.tsx | 4 ++-- .../ExpressionContent.test.tsx | 3 ++- .../ExpressionEditMode.test.tsx | 3 ++- .../SimpleExpression.test.tsx | 7 ++----- .../SubExpressionContent.test.tsx | 7 ++----- .../ExpressionPreview.test.tsx | 3 ++- .../config/Expressions/Expressions.test.tsx | 3 ++- .../config/SelectDataModelComponent.test.tsx | 2 +- .../Panel/PanelComponent.test.tsx | 2 +- .../containers/DesignView/DesignView.test.tsx | 4 ++-- .../NavigationMenu/NavigationMenu.test.tsx | 7 ++----- .../PageAccordion/PageAccordion.test.tsx | 3 ++- .../ReceiptContent/ReceiptContent.test.tsx | 4 ++-- .../src/containers/FormDesigner.test.tsx | 2 +- .../useAddFormContainerMutation.test.ts | 3 ++- .../useAddItemToLayoutMutation.test.ts | 4 ++-- .../mutations/useAddLayoutMutation.test.ts | 3 ++- .../mutations/useAddWidgetMutation.test.ts | 2 +- .../useDeleteFormComponentMutation.test.ts | 3 ++- .../useDeleteFormContainerMutation.test.ts | 4 ++-- .../mutations/useDeleteLayoutMutation.test.ts | 3 ++- .../mutations/useFormLayoutMutation.test.tsx | 3 ++- .../useFormLayoutSettingsMutation.test.ts | 2 +- .../mutations/useRuleConfigMutation.test.ts | 2 +- .../useUpdateFormComponentMutation.test.ts | 4 ++-- ...seUpdateFormComponentOrderMutation.test.ts | 4 ++-- .../useUpdateFormContainerMutation.test.ts | 4 ++-- .../useUpdateLayoutNameMutation.test.ts | 3 ++- .../useUpdateLayoutOrderMutation.test.ts | 3 ++- .../hooks/queries/useRuleModelQuery.test.ts | 2 +- .../src/hooks/useFormLayoutsSelector.test.ts | 8 ++------ .../src/testing/appContextMock.ts | 2 +- .../ux-editor-v3/src/testing/layoutMock.ts | 19 ------------------ .../ux-editor-v3/src/testing/layoutSetMock.ts | 20 +++++++++++++++++++ .../ux-editor-v3/src/testing/stateMocks.ts | 3 ++- frontend/packages/ux-editor/src/App.test.tsx | 2 +- .../ux-editor/src/AppContext.test.tsx | 3 ++- .../Elements/LayoutSetsContainer.test.tsx | 6 +++++- .../Properties/DataModelBindings.test.tsx | 8 ++------ .../PageConfigPanel/EditPageId.test.tsx | 4 ++-- .../HiddenExpressionOnLayout.test.tsx | 3 ++- .../PageConfigPanel/PageConfigPanel.test.tsx | 3 ++- .../EditComponentIdRow.test.tsx | 3 ++- .../config/EditFormComponent.test.tsx | 2 +- .../ExpressionContent.test.tsx | 3 ++- .../config/Expressions/Expressions.test.tsx | 3 ++- .../config/SelectDataModelComponent.test.tsx | 2 +- .../Panel/PanelComponent.test.tsx | 2 +- .../RepeatingGroupComponent.test.tsx | 4 ++-- .../EditDataModelBindings.test.tsx | 2 +- .../containers/DesignView/DesignView.test.tsx | 4 ++-- .../FormItemTitle/FormItemTitle.test.tsx | 3 ++- .../NavigationMenu/NavigationMenu.test.tsx | 7 ++----- .../PageAccordion/PageAccordion.test.tsx | 3 ++- .../ReceiptContent/ReceiptContent.test.tsx | 4 ++-- .../src/containers/FormItemContext.test.tsx | 2 +- .../useAddFormContainerMutation.test.ts | 3 ++- .../useAddItemToLayoutMutation.test.ts | 4 ++-- .../mutations/useAddLayoutMutation.test.ts | 3 ++- .../mutations/useAddWidgetMutation.test.ts | 2 +- .../useDeleteFormComponentMutation.test.ts | 3 ++- .../useDeleteFormContainerMutation.test.ts | 4 ++-- .../mutations/useDeleteLayoutMutation.test.ts | 4 ++-- .../mutations/useFormLayoutMutation.test.tsx | 3 ++- .../useFormLayoutSettingsMutation.test.ts | 2 +- .../mutations/useRuleConfigMutation.test.ts | 2 +- .../useUpdateFormComponentMutation.test.ts | 4 ++-- ...seUpdateFormComponentOrderMutation.test.ts | 4 ++-- .../useUpdateFormContainerMutation.test.ts | 4 ++-- .../useUpdateLayoutNameMutation.test.ts | 3 ++- .../useUpdateLayoutOrderMutation.test.ts | 3 ++- .../hooks/queries/useRuleModelQuery.test.ts | 2 +- .../ux-editor/src/hooks/useFormLayout.test.ts | 8 ++------ .../src/hooks/useFormLayouts.test.ts | 3 ++- .../src/hooks/useSelectedFormLayout.test.ts | 3 ++- .../hooks/useSelectedFormLayoutName.test.tsx | 3 ++- .../useSelectedFormLayoutSetName.test.tsx | 2 +- .../useSelectedFormLayoutWithName.test.ts | 8 ++------ .../src/hooks/useSelectedTaskId.test.tsx | 3 ++- .../ux-editor/src/testing/appContextMock.ts | 3 ++- .../ux-editor/src/testing/layoutMock.ts | 19 ------------------ .../ux-editor/src/testing/layoutSetMock.ts | 20 +++++++++++++++++++ 86 files changed, 188 insertions(+), 174 deletions(-) create mode 100644 frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts create mode 100644 frontend/packages/ux-editor/src/testing/layoutSetMock.ts diff --git a/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx b/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx index 90ea1e9eb63..d976926644d 100644 --- a/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx +++ b/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { renderWithProviders } from '@altinn/ux-editor/testing/mocks'; -import { layoutSet1NameMock, layoutSetsMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock, layoutSetsMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { AppPreviewSubMenuProps } from './AppPreviewSubMenu'; import { AppPreviewSubMenu } from './AppPreviewSubMenu'; import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; diff --git a/frontend/packages/ux-editor-v3/src/App.test.tsx b/frontend/packages/ux-editor-v3/src/App.test.tsx index 705da158b65..28132c133da 100644 --- a/frontend/packages/ux-editor-v3/src/App.test.tsx +++ b/frontend/packages/ux-editor-v3/src/App.test.tsx @@ -8,7 +8,7 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { appStateMock } from './testing/stateMocks'; import type { AppContextProps } from './AppContext'; import ruleHandlerMock from './testing/ruleHandlerMock'; -import { layoutSetsMock } from './testing/layoutMock'; +import { layoutSetsMock } from './testing/layoutSetMock'; const { selectedLayoutSet } = appStateMock.formDesigner.layout; diff --git a/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx b/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx index 897d1ba1b81..f3d36872124 100644 --- a/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx @@ -4,7 +4,11 @@ import userEvent from '@testing-library/user-event'; import { LayoutSetsContainer } from './LayoutSetsContainer'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { renderWithMockStore } from '../../testing/mocks'; -import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock } from '../../testing/layoutMock'; +import { + layoutSet1NameMock, + layoutSet2NameMock, + layoutSetsMock, +} from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { AppContextProps } from '../../AppContext'; import { appStateMock } from '../../testing/stateMocks'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx index 0de25ad600c..1c8811f8fc8 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx @@ -9,7 +9,7 @@ import { mockUseTranslation } from '@studio/testing/mocks/i18nMock'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const user = userEvent.setup(); diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx index 61a0246318b..10c2afdc1c4 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx @@ -15,8 +15,8 @@ import { container1IdMock, externalLayoutsMock, layoutMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx index bee3e86329e..068aaccd870 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx @@ -8,7 +8,8 @@ import { import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../testing/mocks'; import type { IFormLayouts } from '../../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { ExpressionContentProps } from './ExpressionContent'; import { ExpressionContent } from './ExpressionContent'; import { textMock } from '@studio/testing/mocks/i18nMock'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx index 8a058e363d8..354533f80c7 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx @@ -11,7 +11,8 @@ import { import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../../testing/mocks'; import type { IFormLayouts } from '../../../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx index 92f73c9822b..0c62ab7e7d9 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx @@ -9,11 +9,8 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import type { IFormLayouts } from '../../../../../../types/global'; -import { - layout1NameMock, - layoutMock, - layoutSet1NameMock, -} from '../../../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx index d083dcf1686..d08f76c0a23 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx @@ -14,11 +14,8 @@ import { renderWithMockStore } from '../../../../../../testing/mocks'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; -import { - layout1NameMock, - layoutMock, - layoutSet1NameMock, -} from '../../../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { IFormLayouts } from '../../../../../../types/global'; import { DataSource } from '../../../../../../types/Expressions'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx index dfc5a4e2ee9..0da7db8c430 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx @@ -9,7 +9,8 @@ import { import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../../testing/mocks'; import type { IFormLayouts } from '../../../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx index e48a2b40170..d8dec4186b3 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx @@ -5,7 +5,8 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../testing/mocks'; import { formItemContextProviderMock } from '../../../testing/formItemContextMocks'; import type { IFormLayouts } from '../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx index 9e539e17d30..a2cbf4afc89 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx @@ -9,7 +9,7 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import userEvent from '@testing-library/user-event'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const getDatamodelMetadata = () => diff --git a/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx index 5a6ead97b7a..0b530a2772d 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx @@ -15,7 +15,7 @@ import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLay import { textMock } from '@studio/testing/mocks/i18nMock'; import { FormPanelVariant } from 'app-shared/types/FormPanelVariant'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx index 229102a36a7..a1bb9a8a548 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx @@ -15,8 +15,8 @@ import { externalLayoutsMock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx index ce7ef9e9fa7..11ec41fad27 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx @@ -12,11 +12,8 @@ import { } from '../../../../testing/mocks'; import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLayoutSettingsQuery'; import { app, org } from '@studio/testing/testids'; -import { - layout1NameMock, - layout2NameMock, - layoutSet1NameMock, -} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; const mockPageName1: string = layout1NameMock; const mockSelectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx index 479701e8ae8..97136e5c16c 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx @@ -11,7 +11,8 @@ import { renderHookWithMockStore, renderWithMockStore, } from '../../../testing/mocks'; -import { layout1NameMock, layout2NameMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const mockPageName1: string = layout1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx index e9eb4eef986..c007b10125c 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx @@ -10,8 +10,8 @@ import { component2Mock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { IInternalLayout } from '../../../types/global'; import { formLayoutSettingsMock, diff --git a/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx b/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx index 38498e5d2ba..c906b8b46d3 100644 --- a/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx @@ -10,7 +10,7 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { useWidgetsQuery } from '../hooks/queries/useWidgetsQuery'; import ruleHandlerMock from '../testing/ruleHandlerMock'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; const render = () => { const queries = { diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts index 489b541785f..0212f8231f3 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts @@ -6,7 +6,8 @@ import type { AddFormContainerMutationArgs } from './useAddFormContainerMutation import { useAddFormContainerMutation } from './useAddFormContainerMutation'; import type { FormContainer } from '../../types/FormContainer'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; -import { layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts index 18fd15b5ec5..bcd18ffc353 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts @@ -8,12 +8,12 @@ import { useAddItemToLayoutMutation } from './useAddItemToLayoutMutation'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import type { ApplicationAttachmentMetadata } from 'app-shared/types/ApplicationAttachmentMetadata'; import type { IAppState } from '../../types/global'; +import { externalLayoutsMock } from '@altinn/ux-editor-v3/testing/layoutMock'; import { - externalLayoutsMock, layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts index c3b9f291c2a..c5ced20eabd 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts @@ -6,7 +6,8 @@ import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; import { waitFor } from '@testing-library/react'; import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuery'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; -import { externalLayoutsMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { externalLayoutsMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts index 2f9d8389544..85787cb774d 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts @@ -9,7 +9,7 @@ import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import type { ITextResource } from 'app-shared/types/global'; import { useTextResourcesQuery } from 'app-shared/hooks/queries/useTextResourcesQuery'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts index f225f47a4b6..4ba8c4aa5f1 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts @@ -3,7 +3,8 @@ import { renderHookWithMockStore } from '../../testing/mocks'; import { waitFor } from '@testing-library/react'; import { useDeleteFormComponentMutation } from './useDeleteFormComponentMutation'; import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; -import { component2IdMock, layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { component2IdMock, layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts index c1d9abfaa5c..72c337a372a 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts @@ -7,8 +7,8 @@ import { container1IdMock, externalLayoutsMock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts index 162d42bccac..e6b8adf4002 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts @@ -2,7 +2,8 @@ import { queriesMock } from 'app-shared/mocks/queriesMock'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { formLayoutSettingsMock, renderHookWithMockStore } from '../../testing/mocks'; import { useDeleteLayoutMutation } from './useDeleteLayoutMutation'; -import { externalLayoutsMock, layout2NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { externalLayoutsMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx index 87816f2f610..2c96cd1b3c3 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx @@ -4,7 +4,8 @@ import { renderHookWithMockStore } from '../../testing/mocks'; import { useFormLayoutMutation } from './useFormLayoutMutation'; import type { IInternalLayout } from '../../types/global'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; -import { baseContainerIdMock, layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { baseContainerIdMock, layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { AppContextProps } from '../../AppContext'; import type { RefObject } from 'react'; import { createRef } from 'react'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts index 84407e29796..23e2a7b7fbb 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts @@ -3,7 +3,7 @@ import { formLayoutSettingsMock, renderHookWithMockStore } from '../../testing/m import { useFormLayoutSettingsMutation } from './useFormLayoutSettingsMutation'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts index 50afa62312f..330d77a7d59 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts @@ -3,7 +3,7 @@ import { renderHookWithMockStore } from '../../testing/mocks'; import { useRuleConfigMutation } from './useRuleConfigMutation'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts index f267fb300bd..c518e383559 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts @@ -8,8 +8,8 @@ import { component1IdMock, externalLayoutsMock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { FormCheckboxesComponent, FormComponent, diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts index e9e9aacaa8a..406229e9b7b 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts @@ -11,8 +11,8 @@ import { externalLayoutsMock, layout1NameMock, layoutMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts index b5bbc9bb930..c5f41fb205f 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts @@ -11,8 +11,8 @@ import { externalLayoutsMock, layout1Mock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { ruleConfig as ruleConfigMock } from '../../testing/ruleConfigMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts index 10cc8250617..23b08bb7f9d 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts @@ -5,7 +5,8 @@ import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuer import { waitFor } from '@testing-library/react'; import type { UpdateLayoutNameMutationArgs } from './useUpdateLayoutNameMutation'; import { useUpdateLayoutNameMutation } from './useUpdateLayoutNameMutation'; -import { layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts index 9bb302a522c..9a18b6af374 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts @@ -4,7 +4,8 @@ import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuer import { waitFor } from '@testing-library/react'; import type { UpdateLayoutOrderMutationArgs } from './useUpdateLayoutOrderMutation'; import { useUpdateLayoutOrderMutation } from './useUpdateLayoutOrderMutation'; -import { layout1NameMock, layout2NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts b/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts index 6774c4e3397..3a544ce91da 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts @@ -26,7 +26,7 @@ import ruleHandlerMock, { import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts b/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts index 4cec5a46e42..8317ea0dac8 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts @@ -6,12 +6,8 @@ import { } from './useFormLayoutsSelector'; import { renderHookWithMockStore } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; -import { - externalLayoutsMock, - layoutMock, - layout1NameMock, - layoutSet1NameMock, -} from '../testing/layoutMock'; +import { externalLayoutsMock, layoutMock, layout1NameMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { waitFor } from '@testing-library/react'; import { convertExternalLayoutsToInternalFormat } from '../utils/formLayoutsUtils'; import type { IFormLayouts, IInternalLayout, IInternalLayoutWithName } from '../types/global'; diff --git a/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts b/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts index d855c60b85c..75ade196bc2 100644 --- a/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts +++ b/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts @@ -1,6 +1,6 @@ import type { AppContextProps } from '../AppContext'; import type { RefObject } from 'react'; -import { layoutSet1NameMock } from './layoutMock'; +import { layoutSet1NameMock } from './layoutSetMock'; const previewIframeRefMock: RefObject = { current: null, diff --git a/frontend/packages/ux-editor-v3/src/testing/layoutMock.ts b/frontend/packages/ux-editor-v3/src/testing/layoutMock.ts index 48801886a9f..3e58616d53e 100644 --- a/frontend/packages/ux-editor-v3/src/testing/layoutMock.ts +++ b/frontend/packages/ux-editor-v3/src/testing/layoutMock.ts @@ -1,7 +1,6 @@ import { BASE_CONTAINER_ID } from 'app-shared/constants'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import type { IInternalLayout } from '../types/global'; -import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; import type { KeyValuePairs } from 'app-shared/types/KeyValuePairs'; import type { FormComponent } from '../types/FormComponent'; import type { @@ -11,9 +10,6 @@ import type { export const layout1NameMock = 'Side1'; export const layout2NameMock = 'Side2'; -export const layoutSet1NameMock = 'test-layout-set'; -export const layoutSet2NameMock = 'test-layout-set-2'; -export const dataModelNameMock = 'test-data-model'; export const baseContainerIdMock = BASE_CONTAINER_ID; export const component1IdMock = 'Component-1'; export const component1TypeMock = ComponentTypeV3.Input; @@ -102,18 +98,3 @@ export const externalLayoutsMock: FormLayoutsResponseV3 = { [layout1NameMock]: layout1Mock, [layout2NameMock]: layout2Mock, }; - -export const layoutSetsMock: LayoutSets = { - sets: [ - { - id: layoutSet1NameMock, - dataType: 'datamodel', - tasks: ['Task_1'], - }, - { - id: layoutSet2NameMock, - dataType: 'datamodel-2', - tasks: ['Task_2'], - }, - ], -}; diff --git a/frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts b/frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts new file mode 100644 index 00000000000..1c89c23adae --- /dev/null +++ b/frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts @@ -0,0 +1,20 @@ +import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; + +export const dataModelNameMock = 'test-data-model'; +export const layoutSet1NameMock = 'test-layout-set'; +export const layoutSet2NameMock = 'test-layout-set-2'; + +export const layoutSetsMock: LayoutSets = { + sets: [ + { + id: layoutSet1NameMock, + dataType: 'datamodel', + tasks: ['Task_1'], + }, + { + id: layoutSet2NameMock, + dataType: 'datamodel-2', + tasks: ['Task_2'], + }, + ], +}; diff --git a/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts b/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts index 285997a5a99..e8a648f202d 100644 --- a/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts +++ b/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts @@ -1,7 +1,8 @@ import type { ITextResourcesState } from '../features/appData/textResources/textResourcesSlice'; import type { IAppDataState } from '../features/appData/appDataReducers'; import type { IFormDesignerState } from '../features/formDesigner/formDesignerReducer'; -import { layout1NameMock, layoutSet1NameMock } from './layoutMock'; +import { layout1NameMock } from './layoutMock'; +import { layoutSet1NameMock } from './layoutSetMock'; import type { IAppState } from '../types/global'; export const textResourcesMock: ITextResourcesState = { diff --git a/frontend/packages/ux-editor/src/App.test.tsx b/frontend/packages/ux-editor/src/App.test.tsx index 420a8942498..1e2a02c9803 100644 --- a/frontend/packages/ux-editor/src/App.test.tsx +++ b/frontend/packages/ux-editor/src/App.test.tsx @@ -7,7 +7,7 @@ import { typedLocalStorage } from 'app-shared/utils/webStorage'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import type { AppContextProps } from './AppContext'; import ruleHandlerMock from './testing/ruleHandlerMock'; -import { layoutSetsMock } from './testing/layoutMock'; +import { layoutSetsMock } from './testing/layoutSetMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; const mockQueries: Partial = { diff --git a/frontend/packages/ux-editor/src/AppContext.test.tsx b/frontend/packages/ux-editor/src/AppContext.test.tsx index 9f5c45c245f..f2dabde7029 100644 --- a/frontend/packages/ux-editor/src/AppContext.test.tsx +++ b/frontend/packages/ux-editor/src/AppContext.test.tsx @@ -10,7 +10,8 @@ import { MemoryRouter } from 'react-router-dom'; import { QueryKey } from 'app-shared/types/QueryKey'; import { useAppContext } from './hooks'; import type { QueryClient } from '@tanstack/react-query'; -import { layout1NameMock, layoutSet1NameMock } from './testing/layoutMock'; +import { layout1NameMock } from './testing/layoutMock'; +import { layoutSet1NameMock } from './testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const mockSelectedFormLayoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx b/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx index 892c197ce46..10ae0598c63 100644 --- a/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx +++ b/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx @@ -4,7 +4,11 @@ import userEvent from '@testing-library/user-event'; import { LayoutSetsContainer } from './LayoutSetsContainer'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { renderWithProviders } from '../../testing/mocks'; -import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock } from '../../testing/layoutMock'; +import { + layoutSet1NameMock, + layoutSet2NameMock, + layoutSetsMock, +} from '../../testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { appContextMock } from '../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx index 429aabe629f..09b134f82af 100644 --- a/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx @@ -12,12 +12,8 @@ import { componentSchemaMocks } from '../../testing/componentSchemaMocks'; import { ComponentType } from 'app-shared/types/ComponentType'; import type { FormItem } from '../../types/FormItem'; import { componentMocks } from '../../testing/componentMocks'; -import { - component3IdMock, - component3Mock, - layoutMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +import { component3IdMock, component3Mock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const user = userEvent.setup(); diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx index d3236a2869b..9f0bbb5c4bf 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx @@ -12,8 +12,8 @@ import { externalLayoutsMock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx index afdb44859d7..0e312a95f45 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx @@ -6,7 +6,8 @@ import { QueryKey } from 'app-shared/types/QueryKey'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { HiddenExpressionOnLayout } from './HiddenExpressionOnLayout'; import type { IFormLayouts } from '../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import type { BooleanExpression } from '@studio/components'; import { GeneralRelationOperator } from '@studio/components'; diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx index af985fa825a..2ed56555ea9 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx @@ -8,7 +8,8 @@ import type { ITextResources } from 'app-shared/types/global'; import { DEFAULT_LANGUAGE, DEFAULT_SELECTED_LAYOUT_NAME } from 'app-shared/constants'; import { textMock } from '@studio/testing/mocks/i18nMock'; import type { IFormLayouts } from '../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data diff --git a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx index d31a76b78d1..d83d9ed097a 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx @@ -8,7 +8,8 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import type { IFormLayouts } from '../../../../types/global'; import { QueryKey } from 'app-shared/types/QueryKey'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx index 4582614c589..8d76096a93b 100644 --- a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx @@ -9,7 +9,7 @@ import { ComponentType } from 'app-shared/types/ComponentType'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; import { componentMocks } from '../../testing/componentMocks'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx index 564ba1c1920..28e950d8df9 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx @@ -3,7 +3,8 @@ import { screen } from '@testing-library/react'; import { parsableLogicalExpression } from '../../../testing/expressionMocks'; import { renderWithProviders } from '../../../testing/mocks'; import type { IFormLayouts } from '../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { ExpressionContentProps } from './ExpressionContent'; import { ExpressionContent } from './ExpressionContent'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; diff --git a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx index 3b1bcc17590..cf425db6926 100644 --- a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx @@ -3,7 +3,8 @@ import { screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { renderWithProviders } from '../../../testing/mocks'; import type { IFormLayouts } from '../../../types/global'; -import { layout1NameMock, layoutMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx index c7edfd86cd7..eed8b0463a7 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx @@ -9,7 +9,7 @@ import { getDataModelFieldsFilter } from '../../utils/datamodel'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; const dataModelName = undefined; diff --git a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx index 65e3953fc42..d50aa03b753 100644 --- a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx @@ -15,7 +15,7 @@ import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLay import { textMock } from '@studio/testing/mocks/i18nMock'; import { FormPanelVariant } from 'app-shared/types/FormPanelVariant'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx index cdb91e9b4ce..07c2c8c4200 100644 --- a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx @@ -9,8 +9,8 @@ import { container2IdMock, layout1NameMock, layoutMock, - layoutSet1NameMock, -} from '../../../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import type { IFormLayouts } from '../../../../types/global'; diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx index 526a66ab49c..9a70a302ac8 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx @@ -11,7 +11,7 @@ import { QueryKey } from 'app-shared/types/QueryKey'; import { componentMocks } from '../../../../testing/componentMocks'; import type { FormItem } from '../../../../types/FormItem'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; const dataModelName = undefined; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx index 01881072eb6..48456f479ed 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx @@ -15,8 +15,8 @@ import { externalLayoutsMock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { appContextMock } from '../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx index 35f83b76252..9dba1b13f37 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx @@ -12,7 +12,8 @@ import { FormItemContext } from '../../../../FormItemContext'; import { formItemContextProviderMock } from '../../../../../testing/formItemContextMocks'; import { queriesMock } from 'app-shared/mocks/queriesMock'; import { app, org } from '@studio/testing/testids'; -import { layout1NameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; const mockHandleDiscard = jest.fn(); diff --git a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx index 2607532871a..835920dd6dd 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx @@ -11,11 +11,8 @@ import { renderWithProviders, } from '../../../../testing/mocks'; import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLayoutSettingsQuery'; -import { - layout1NameMock, - layout2NameMock, - layoutSet1NameMock, -} from '../../../../testing/layoutMock'; +import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; const mockPageName1: string = layout1NameMock; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx index 8ab020d47b2..5e15dc75909 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx @@ -11,7 +11,8 @@ import { renderHookWithProviders, renderWithProviders, } from '../../../testing/mocks'; -import { layout1NameMock, layoutSet1NameMock } from '../../../testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { queriesMock } from 'app-shared/mocks/queriesMock'; import { appContextMock } from '../../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx index 3c37127130a..94e7e6795e4 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx @@ -10,8 +10,8 @@ import { component2Mock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { IInternalLayout } from '../../../types/global'; import { formLayoutSettingsMock, diff --git a/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx b/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx index 8eb191f4d79..5ce081bf0d3 100644 --- a/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx +++ b/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx @@ -14,9 +14,9 @@ import { externalLayoutsMock, layout1NameMock, layoutMock, - layoutSet1NameMock, } from '../testing/layoutMock'; import { app, org } from '@studio/testing/testids'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; const layoutName = layout1NameMock; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts index a61e6565a09..5bd395e1add 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts @@ -6,7 +6,8 @@ import type { AddFormContainerMutationArgs } from './useAddFormContainerMutation import { useAddFormContainerMutation } from './useAddFormContainerMutation'; import type { FormContainer } from '../../types/FormContainer'; import { ComponentType } from 'app-shared/types/ComponentType'; -import { layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts index 3d94700f085..382a243f677 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts @@ -6,12 +6,12 @@ import type { AddFormItemMutationArgs } from './useAddItemToLayoutMutation'; import { useAddItemToLayoutMutation } from './useAddItemToLayoutMutation'; import { ComponentType } from 'app-shared/types/ComponentType'; import type { ApplicationAttachmentMetadata } from 'app-shared/types/ApplicationAttachmentMetadata'; +import { externalLayoutsMock } from '@altinn/ux-editor/testing/layoutMock'; import { - externalLayoutsMock, layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts index 8ff3f35adbe..661d3c9d291 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts @@ -6,7 +6,8 @@ import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; import { waitFor } from '@testing-library/react'; import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuery'; import { ComponentType } from 'app-shared/types/ComponentType'; -import { externalLayoutsMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { externalLayoutsMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts index 5e3859664cf..4679222b829 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts @@ -9,7 +9,7 @@ import { ComponentType } from 'app-shared/types/ComponentType'; import type { ITextResource } from 'app-shared/types/global'; import { useTextResourcesQuery } from 'app-shared/hooks/queries/useTextResourcesQuery'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts index 260b01ab7c7..01b1a286993 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts @@ -3,7 +3,8 @@ import { renderHookWithProviders } from '../../testing/mocks'; import { waitFor } from '@testing-library/react'; import { useDeleteFormComponentMutation } from './useDeleteFormComponentMutation'; import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; -import { component2IdMock, layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { component2IdMock, layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts index f7556f1d015..465c8dd0403 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts @@ -8,8 +8,8 @@ import { container1IdMock, externalLayoutsMock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts index e3f45a47f8e..83ac267d0eb 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts @@ -6,8 +6,8 @@ import { externalLayoutsMock, layout1NameMock, layout2NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { appContextMock } from '../../testing/appContextMock'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx index 1eed0c3f6d0..b1beb6a87d7 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx @@ -4,7 +4,8 @@ import { renderHookWithProviders } from '../../testing/mocks'; import { useFormLayoutMutation } from './useFormLayoutMutation'; import type { IInternalLayout } from '../../types/global'; import { ComponentType } from 'app-shared/types/ComponentType'; -import { baseContainerIdMock, layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { baseContainerIdMock, layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts index b6b46aa3b3e..965e6acbc7c 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts @@ -3,7 +3,7 @@ import { formLayoutSettingsMock, renderHookWithProviders } from '../../testing/m import { useFormLayoutSettingsMutation } from './useFormLayoutSettingsMutation'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts index fdef7f15465..7627ba4f4f1 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts @@ -3,7 +3,7 @@ import { renderHookWithProviders } from '../../testing/mocks'; import { useRuleConfigMutation } from './useRuleConfigMutation'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts index d040d1e00e9..33317afb330 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts @@ -8,8 +8,8 @@ import { component1IdMock, externalLayoutsMock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { FormCheckboxesComponent, FormComponent, diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts index b7465430c68..a3e4d4c9089 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts @@ -13,8 +13,8 @@ import { externalLayoutsMock, layout1NameMock, layoutMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts index 4ae91eb7f47..8ffc345d39b 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts @@ -11,8 +11,8 @@ import { externalLayoutsMock, layout1Mock, layout1NameMock, - layoutSet1NameMock, -} from '../../testing/layoutMock'; +} from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { ruleConfig as ruleConfigMock } from '../../testing/ruleConfigMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts index 35b0d4c24c6..8e23f5fbf55 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts @@ -5,7 +5,8 @@ import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuer import { waitFor } from '@testing-library/react'; import type { UpdateLayoutNameMutationArgs } from './useUpdateLayoutNameMutation'; import { useUpdateLayoutNameMutation } from './useUpdateLayoutNameMutation'; -import { layout1NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts index f05c9cda710..ad9dcf2b0cc 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts @@ -4,7 +4,8 @@ import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuer import { waitFor } from '@testing-library/react'; import type { UpdateLayoutOrderMutationArgs } from './useUpdateLayoutOrderMutation'; import { useUpdateLayoutOrderMutation } from './useUpdateLayoutOrderMutation'; -import { layout1NameMock, layout2NameMock, layoutSet1NameMock } from '../../testing/layoutMock'; +import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts b/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts index 7a7d6597b13..b887afee23f 100644 --- a/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts +++ b/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts @@ -26,7 +26,7 @@ import ruleHandlerMock, { import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts b/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts index 5654a9bda17..c0e784d7ac0 100644 --- a/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts @@ -1,12 +1,8 @@ import { useFormLayout } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; -import { - externalLayoutsMock, - layout1NameMock, - layoutMock, - layoutSet1NameMock, -} from '../testing/layoutMock'; +import { externalLayoutsMock, layout1NameMock, layoutMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts b/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts index 7269a1ec413..98d030df180 100644 --- a/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts @@ -1,7 +1,8 @@ import { useFormLayouts } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; -import { externalLayoutsMock, layoutSet1NameMock } from '../testing/layoutMock'; +import { externalLayoutsMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { waitFor } from '@testing-library/react'; import { convertExternalLayoutsToInternalFormat } from '../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts index 4e11afee9f5..0a8bbfdffd9 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts @@ -1,9 +1,10 @@ import { useSelectedFormLayout } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; -import { externalLayoutsMock, layoutMock, layoutSet1NameMock } from '../testing/layoutMock'; +import { externalLayoutsMock, layoutMock } from '../testing/layoutMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx index 93d245a1dc0..d8f35d10f82 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx @@ -1,7 +1,8 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedFormLayoutName } from './'; -import { layout1NameMock, layoutSet1NameMock } from '../testing/layoutMock'; +import { layout1NameMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { renderHook } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx index f1692a751ce..de829b2da4b 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedFormLayoutSetName } from './'; -import { layoutSet1NameMock, layoutSetsMock } from '../testing/layoutMock'; +import { layoutSet1NameMock, layoutSetsMock } from '../testing/layoutSetMock'; import { renderHook } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts index 83e274318ce..090af14ef15 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts @@ -1,12 +1,8 @@ import { useSelectedFormLayoutWithName } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; -import { - externalLayoutsMock, - layoutMock, - layout1NameMock, - layoutSet1NameMock, -} from '../testing/layoutMock'; +import { externalLayoutsMock, layoutMock, layout1NameMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx index d764b5f455e..91774c99f5c 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx @@ -1,7 +1,8 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedTaskId } from './'; -import { layout1NameMock, layoutSet1NameMock } from '../testing/layoutMock'; +import { layout1NameMock } from '../testing/layoutMock'; +import { layoutSet1NameMock } from '../testing/layoutSetMock'; import { renderHook } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/testing/appContextMock.ts b/frontend/packages/ux-editor/src/testing/appContextMock.ts index 3e305702615..630e6539067 100644 --- a/frontend/packages/ux-editor/src/testing/appContextMock.ts +++ b/frontend/packages/ux-editor/src/testing/appContextMock.ts @@ -1,6 +1,7 @@ import type { AppContextProps } from '../AppContext'; import type { RefObject } from 'react'; -import { layout1NameMock, layoutSet1NameMock } from './layoutMock'; +import { layoutSet1NameMock } from './layoutSetMock'; +import { layout1NameMock } from './layoutMock'; const previewIframeRefMock: RefObject = { current: null, diff --git a/frontend/packages/ux-editor/src/testing/layoutMock.ts b/frontend/packages/ux-editor/src/testing/layoutMock.ts index b28f58c884c..59944d43e50 100644 --- a/frontend/packages/ux-editor/src/testing/layoutMock.ts +++ b/frontend/packages/ux-editor/src/testing/layoutMock.ts @@ -1,7 +1,6 @@ import { BASE_CONTAINER_ID } from 'app-shared/constants'; import { ComponentType } from 'app-shared/types/ComponentType'; import type { IInternalLayout } from '../types/global'; -import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; import type { KeyValuePairs } from 'app-shared/types/KeyValuePairs'; import type { FormComponent } from '../types/FormComponent'; import type { @@ -11,9 +10,6 @@ import type { export const layout1NameMock = 'Side1'; export const layout2NameMock = 'Side2'; -export const layoutSet1NameMock = 'test-layout-set'; -export const layoutSet2NameMock = 'test-layout-set-2'; -export const dataModelNameMock = 'test-data-model'; export const baseContainerIdMock = BASE_CONTAINER_ID; export const component1IdMock = 'Component-1'; export const component1TypeMock = ComponentType.Input; @@ -161,18 +157,3 @@ export const externalLayoutsMock: FormLayoutsResponse = { [layout1NameMock]: layout1Mock, [layout2NameMock]: layout2Mock, }; - -export const layoutSetsMock: LayoutSets = { - sets: [ - { - id: layoutSet1NameMock, - dataType: 'datamodel', - tasks: ['Task_1'], - }, - { - id: layoutSet2NameMock, - dataType: 'datamodel-2', - tasks: ['Task_2'], - }, - ], -}; diff --git a/frontend/packages/ux-editor/src/testing/layoutSetMock.ts b/frontend/packages/ux-editor/src/testing/layoutSetMock.ts new file mode 100644 index 00000000000..1c89c23adae --- /dev/null +++ b/frontend/packages/ux-editor/src/testing/layoutSetMock.ts @@ -0,0 +1,20 @@ +import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; + +export const dataModelNameMock = 'test-data-model'; +export const layoutSet1NameMock = 'test-layout-set'; +export const layoutSet2NameMock = 'test-layout-set-2'; + +export const layoutSetsMock: LayoutSets = { + sets: [ + { + id: layoutSet1NameMock, + dataType: 'datamodel', + tasks: ['Task_1'], + }, + { + id: layoutSet2NameMock, + dataType: 'datamodel-2', + tasks: ['Task_2'], + }, + ], +}; From 8a9db8e3b821924c2bd159c9342a7bf00401511d Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 28 May 2024 13:21:11 +0200 Subject: [PATCH 25/26] Rename layoutSetMock -> layoutSetsMock --- frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx | 2 +- frontend/packages/ux-editor-v3/src/App.test.tsx | 2 +- .../src/components/Elements/LayoutSetsContainer.test.tsx | 2 +- .../src/components/config/EditFormComponent.test.tsx | 2 +- .../src/components/config/EditFormContainer.test.tsx | 2 +- .../Expressions/ExpressionContent/ExpressionContent.test.tsx | 2 +- .../ExpressionEditMode/ExpressionEditMode.test.tsx | 2 +- .../SimpleExpression/SimpleExpression.test.tsx | 2 +- .../SimpleExpression/SubExpressionContent.test.tsx | 2 +- .../ExpressionPreview/ExpressionPreview.test.tsx | 2 +- .../src/components/config/Expressions/Expressions.test.tsx | 2 +- .../src/components/config/SelectDataModelComponent.test.tsx | 2 +- .../componentSpecificContent/Panel/PanelComponent.test.tsx | 2 +- .../ux-editor-v3/src/containers/DesignView/DesignView.test.tsx | 2 +- .../PageAccordion/NavigationMenu/NavigationMenu.test.tsx | 2 +- .../containers/DesignView/PageAccordion/PageAccordion.test.tsx | 2 +- .../DesignView/ReceiptContent/ReceiptContent.test.tsx | 2 +- .../packages/ux-editor-v3/src/containers/FormDesigner.test.tsx | 2 +- .../src/hooks/mutations/useAddFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useAddItemToLayoutMutation.test.ts | 2 +- .../src/hooks/mutations/useAddLayoutMutation.test.ts | 2 +- .../src/hooks/mutations/useAddWidgetMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteFormComponentMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteLayoutMutation.test.ts | 2 +- .../src/hooks/mutations/useFormLayoutMutation.test.tsx | 2 +- .../src/hooks/mutations/useFormLayoutSettingsMutation.test.ts | 2 +- .../src/hooks/mutations/useRuleConfigMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateFormComponentMutation.test.ts | 2 +- .../hooks/mutations/useUpdateFormComponentOrderMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateLayoutNameMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts | 2 +- .../ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts | 2 +- .../ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts | 2 +- .../src/testing/{layoutSetMock.ts => layoutSetsMock.ts} | 0 frontend/packages/ux-editor/src/App.test.tsx | 2 +- frontend/packages/ux-editor/src/AppContext.test.tsx | 2 +- .../src/components/Elements/LayoutSetsContainer.test.tsx | 2 +- .../src/components/Properties/DataModelBindings.test.tsx | 2 +- .../components/Properties/PageConfigPanel/EditPageId.test.tsx | 2 +- .../PageConfigPanel/HiddenExpressionOnLayout.test.tsx | 2 +- .../Properties/PageConfigPanel/PageConfigPanel.test.tsx | 2 +- .../EditComponentIdRow/EditComponentIdRow.test.tsx | 2 +- .../ux-editor/src/components/config/EditFormComponent.test.tsx | 2 +- .../config/ExpressionContent/ExpressionContent.test.tsx | 2 +- .../src/components/config/Expressions/Expressions.test.tsx | 2 +- .../src/components/config/SelectDataModelComponent.test.tsx | 2 +- .../componentSpecificContent/Panel/PanelComponent.test.tsx | 2 +- .../RepeatingGroup/RepeatingGroupComponent.test.tsx | 2 +- .../EditDataModelBindings/EditDataModelBindings.test.tsx | 2 +- .../ux-editor/src/containers/DesignView/DesignView.test.tsx | 2 +- .../FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx | 2 +- .../PageAccordion/NavigationMenu/NavigationMenu.test.tsx | 2 +- .../containers/DesignView/PageAccordion/PageAccordion.test.tsx | 2 +- .../DesignView/ReceiptContent/ReceiptContent.test.tsx | 2 +- .../packages/ux-editor/src/containers/FormItemContext.test.tsx | 2 +- .../src/hooks/mutations/useAddFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useAddItemToLayoutMutation.test.ts | 2 +- .../ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts | 2 +- .../ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteFormComponentMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useDeleteLayoutMutation.test.ts | 2 +- .../src/hooks/mutations/useFormLayoutMutation.test.tsx | 2 +- .../src/hooks/mutations/useFormLayoutSettingsMutation.test.ts | 2 +- .../ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateFormComponentMutation.test.ts | 2 +- .../hooks/mutations/useUpdateFormComponentOrderMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateFormContainerMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateLayoutNameMutation.test.ts | 2 +- .../src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts | 2 +- .../ux-editor/src/hooks/queries/useRuleModelQuery.test.ts | 2 +- frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts | 2 +- frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts | 2 +- .../packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts | 2 +- .../ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx | 2 +- .../ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx | 2 +- .../ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts | 2 +- .../packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx | 2 +- .../src/testing/{layoutSetMock.ts => layoutSetsMock.ts} | 0 81 files changed, 79 insertions(+), 79 deletions(-) rename frontend/packages/ux-editor-v3/src/testing/{layoutSetMock.ts => layoutSetsMock.ts} (100%) rename frontend/packages/ux-editor/src/testing/{layoutSetMock.ts => layoutSetsMock.ts} (100%) diff --git a/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx b/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx index d976926644d..7455a3e0471 100644 --- a/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx +++ b/frontend/app-preview/src/components/AppPreviewSubMenu.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { renderWithProviders } from '@altinn/ux-editor/testing/mocks'; -import { layoutSet1NameMock, layoutSetsMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock, layoutSetsMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { AppPreviewSubMenuProps } from './AppPreviewSubMenu'; import { AppPreviewSubMenu } from './AppPreviewSubMenu'; import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; diff --git a/frontend/packages/ux-editor-v3/src/App.test.tsx b/frontend/packages/ux-editor-v3/src/App.test.tsx index 28132c133da..4b16a3968e0 100644 --- a/frontend/packages/ux-editor-v3/src/App.test.tsx +++ b/frontend/packages/ux-editor-v3/src/App.test.tsx @@ -8,7 +8,7 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { appStateMock } from './testing/stateMocks'; import type { AppContextProps } from './AppContext'; import ruleHandlerMock from './testing/ruleHandlerMock'; -import { layoutSetsMock } from './testing/layoutSetMock'; +import { layoutSetsMock } from './testing/layoutSetsMock'; const { selectedLayoutSet } = appStateMock.formDesigner.layout; diff --git a/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx b/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx index f3d36872124..320fa9de26a 100644 --- a/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/Elements/LayoutSetsContainer.test.tsx @@ -8,7 +8,7 @@ import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '@altinn/ux-editor-v3/testing/layoutSetMock'; +} from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { AppContextProps } from '../../AppContext'; import { appStateMock } from '../../testing/stateMocks'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx index 1c8811f8fc8..1a9d21f1840 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormComponent.test.tsx @@ -9,7 +9,7 @@ import { mockUseTranslation } from '@studio/testing/mocks/i18nMock'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const user = userEvent.setup(); diff --git a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx index 10c2afdc1c4..c1181c0b1d1 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/EditFormContainer.test.tsx @@ -16,7 +16,7 @@ import { externalLayoutsMock, layoutMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx index 068aaccd870..80a4a94c771 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionContent.test.tsx @@ -9,7 +9,7 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../testing/mocks'; import type { IFormLayouts } from '../../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { ExpressionContentProps } from './ExpressionContent'; import { ExpressionContent } from './ExpressionContent'; import { textMock } from '@studio/testing/mocks/i18nMock'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx index 354533f80c7..6692196ea85 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/ExpressionEditMode.test.tsx @@ -12,7 +12,7 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../../testing/mocks'; import type { IFormLayouts } from '../../../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx index 0c62ab7e7d9..0a977ad109d 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SimpleExpression.test.tsx @@ -10,7 +10,7 @@ import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import type { IFormLayouts } from '../../../../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx index d08f76c0a23..0029b6688ee 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionEditMode/SimpleExpression/SubExpressionContent.test.tsx @@ -15,7 +15,7 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { IFormLayouts } from '../../../../../../types/global'; import { DataSource } from '../../../../../../types/Expressions'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx index 0da7db8c430..d56e2a37a89 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/ExpressionContent/ExpressionPreview/ExpressionPreview.test.tsx @@ -10,7 +10,7 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { renderWithMockStore } from '../../../../../testing/mocks'; import type { IFormLayouts } from '../../../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx index d8dec4186b3..f23c2272037 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/Expressions/Expressions.test.tsx @@ -6,7 +6,7 @@ import { renderWithMockStore } from '../../../testing/mocks'; import { formItemContextProviderMock } from '../../../testing/formItemContextMocks'; import type { IFormLayouts } from '../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx index a2cbf4afc89..f1a38551a84 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/SelectDataModelComponent.test.tsx @@ -9,7 +9,7 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import userEvent from '@testing-library/user-event'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const getDatamodelMetadata = () => diff --git a/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx b/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx index 0b530a2772d..b8f5d1b2995 100644 --- a/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx @@ -15,7 +15,7 @@ import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLay import { textMock } from '@studio/testing/mocks/i18nMock'; import { FormPanelVariant } from 'app-shared/types/FormPanelVariant'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx index a1bb9a8a548..6a7b5b4e178 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/DesignView.test.tsx @@ -16,7 +16,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx index 11ec41fad27..c52bb226e1b 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx @@ -13,7 +13,7 @@ import { import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLayoutSettingsQuery'; import { app, org } from '@studio/testing/testids'; import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; const mockPageName1: string = layout1NameMock; const mockSelectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx index 97136e5c16c..8c7098b856a 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx @@ -12,7 +12,7 @@ import { renderWithMockStore, } from '../../../testing/mocks'; import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const mockPageName1: string = layout1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx b/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx index c007b10125c..bf440026f55 100644 --- a/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx @@ -11,7 +11,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { IInternalLayout } from '../../../types/global'; import { formLayoutSettingsMock, diff --git a/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx b/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx index c906b8b46d3..dad4a718019 100644 --- a/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx +++ b/frontend/packages/ux-editor-v3/src/containers/FormDesigner.test.tsx @@ -10,7 +10,7 @@ import { textMock } from '@studio/testing/mocks/i18nMock'; import { useWidgetsQuery } from '../hooks/queries/useWidgetsQuery'; import ruleHandlerMock from '../testing/ruleHandlerMock'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; const render = () => { const queries = { diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts index 0212f8231f3..a098b198c3a 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddFormContainerMutation.test.ts @@ -7,7 +7,7 @@ import { useAddFormContainerMutation } from './useAddFormContainerMutation'; import type { FormContainer } from '../../types/FormContainer'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import { layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts index bcd18ffc353..b8fcd0eb772 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddItemToLayoutMutation.test.ts @@ -13,7 +13,7 @@ import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '@altinn/ux-editor-v3/testing/layoutSetMock'; +} from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts index c5ced20eabd..b3b6fe5ff98 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddLayoutMutation.test.ts @@ -7,7 +7,7 @@ import { waitFor } from '@testing-library/react'; import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuery'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import { externalLayoutsMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts index 85787cb774d..047f0f1eeb0 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useAddWidgetMutation.test.ts @@ -9,7 +9,7 @@ import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import type { ITextResource } from 'app-shared/types/global'; import { useTextResourcesQuery } from 'app-shared/hooks/queries/useTextResourcesQuery'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts index 4ba8c4aa5f1..ee0d1c1994d 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormComponentMutation.test.ts @@ -4,7 +4,7 @@ import { waitFor } from '@testing-library/react'; import { useDeleteFormComponentMutation } from './useDeleteFormComponentMutation'; import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; import { component2IdMock, layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts index 72c337a372a..a3ca0dc4ae0 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteFormContainerMutation.test.ts @@ -8,7 +8,7 @@ import { externalLayoutsMock, layout1NameMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts index e6b8adf4002..7fd7d06bc59 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useDeleteLayoutMutation.test.ts @@ -3,7 +3,7 @@ import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { formLayoutSettingsMock, renderHookWithMockStore } from '../../testing/mocks'; import { useDeleteLayoutMutation } from './useDeleteLayoutMutation'; import { externalLayoutsMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx index 2c96cd1b3c3..a46f0eca0ab 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutMutation.test.tsx @@ -5,7 +5,7 @@ import { useFormLayoutMutation } from './useFormLayoutMutation'; import type { IInternalLayout } from '../../types/global'; import { ComponentTypeV3 } from 'app-shared/types/ComponentTypeV3'; import { baseContainerIdMock, layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { AppContextProps } from '../../AppContext'; import type { RefObject } from 'react'; import { createRef } from 'react'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts index 23e2a7b7fbb..1434e9893bf 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts @@ -3,7 +3,7 @@ import { formLayoutSettingsMock, renderHookWithMockStore } from '../../testing/m import { useFormLayoutSettingsMutation } from './useFormLayoutSettingsMutation'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts index 330d77a7d59..7e526023987 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useRuleConfigMutation.test.ts @@ -3,7 +3,7 @@ import { renderHookWithMockStore } from '../../testing/mocks'; import { useRuleConfigMutation } from './useRuleConfigMutation'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts index c518e383559..5008630b419 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentMutation.test.ts @@ -9,7 +9,7 @@ import { externalLayoutsMock, layout1NameMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { FormCheckboxesComponent, FormComponent, diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts index 406229e9b7b..90b40adff2d 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts @@ -12,7 +12,7 @@ import { layout1NameMock, layoutMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts index c5f41fb205f..2fc65272eb2 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateFormContainerMutation.test.ts @@ -12,7 +12,7 @@ import { layout1Mock, layout1NameMock, } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { ruleConfig as ruleConfigMock } from '../../testing/ruleConfigMock'; import type { FormLayoutsResponseV3 } from 'app-shared/types/api'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts index 23b08bb7f9d..fb686e111ab 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts @@ -6,7 +6,7 @@ import { waitFor } from '@testing-library/react'; import type { UpdateLayoutNameMutationArgs } from './useUpdateLayoutNameMutation'; import { useUpdateLayoutNameMutation } from './useUpdateLayoutNameMutation'; import { layout1NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts index 9a18b6af374..480009e53bb 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts @@ -5,7 +5,7 @@ import { waitFor } from '@testing-library/react'; import type { UpdateLayoutOrderMutationArgs } from './useUpdateLayoutOrderMutation'; import { useUpdateLayoutOrderMutation } from './useUpdateLayoutOrderMutation'; import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor-v3/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts b/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts index 3a544ce91da..3d2336205b5 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/queries/useRuleModelQuery.test.ts @@ -26,7 +26,7 @@ import ruleHandlerMock, { import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor-v3/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts b/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts index 8317ea0dac8..683a9074394 100644 --- a/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts +++ b/frontend/packages/ux-editor-v3/src/hooks/useFormLayoutsSelector.test.ts @@ -7,7 +7,7 @@ import { import { renderHookWithMockStore } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; import { externalLayoutsMock, layoutMock, layout1NameMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { waitFor } from '@testing-library/react'; import { convertExternalLayoutsToInternalFormat } from '../utils/formLayoutsUtils'; import type { IFormLayouts, IInternalLayout, IInternalLayoutWithName } from '../types/global'; diff --git a/frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts b/frontend/packages/ux-editor-v3/src/testing/layoutSetsMock.ts similarity index 100% rename from frontend/packages/ux-editor-v3/src/testing/layoutSetMock.ts rename to frontend/packages/ux-editor-v3/src/testing/layoutSetsMock.ts diff --git a/frontend/packages/ux-editor/src/App.test.tsx b/frontend/packages/ux-editor/src/App.test.tsx index 1e2a02c9803..3e5deccddf7 100644 --- a/frontend/packages/ux-editor/src/App.test.tsx +++ b/frontend/packages/ux-editor/src/App.test.tsx @@ -7,7 +7,7 @@ import { typedLocalStorage } from 'app-shared/utils/webStorage'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import type { AppContextProps } from './AppContext'; import ruleHandlerMock from './testing/ruleHandlerMock'; -import { layoutSetsMock } from './testing/layoutSetMock'; +import { layoutSetsMock } from './testing/layoutSetsMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; const mockQueries: Partial = { diff --git a/frontend/packages/ux-editor/src/AppContext.test.tsx b/frontend/packages/ux-editor/src/AppContext.test.tsx index f2dabde7029..5e4468e08a9 100644 --- a/frontend/packages/ux-editor/src/AppContext.test.tsx +++ b/frontend/packages/ux-editor/src/AppContext.test.tsx @@ -11,7 +11,7 @@ import { QueryKey } from 'app-shared/types/QueryKey'; import { useAppContext } from './hooks'; import type { QueryClient } from '@tanstack/react-query'; import { layout1NameMock } from './testing/layoutMock'; -import { layoutSet1NameMock } from './testing/layoutSetMock'; +import { layoutSet1NameMock } from './testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const mockSelectedFormLayoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx b/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx index 10ae0598c63..8e9c1a0b880 100644 --- a/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx +++ b/frontend/packages/ux-editor/src/components/Elements/LayoutSetsContainer.test.tsx @@ -8,7 +8,7 @@ import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '../../testing/layoutSetMock'; +} from '../../testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { appContextMock } from '../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx index 09b134f82af..f7b5b2a17f9 100644 --- a/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/DataModelBindings.test.tsx @@ -13,7 +13,7 @@ import { ComponentType } from 'app-shared/types/ComponentType'; import type { FormItem } from '../../types/FormItem'; import { componentMocks } from '../../testing/componentMocks'; import { component3IdMock, component3Mock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const user = userEvent.setup(); diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx index 9f0bbb5c4bf..27acbfde78a 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/EditPageId.test.tsx @@ -13,7 +13,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx index 0e312a95f45..4eeb08f5cd8 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/HiddenExpressionOnLayout.test.tsx @@ -7,7 +7,7 @@ import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { HiddenExpressionOnLayout } from './HiddenExpressionOnLayout'; import type { IFormLayouts } from '../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import type { BooleanExpression } from '@studio/components'; import { GeneralRelationOperator } from '@studio/components'; diff --git a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx index 2ed56555ea9..3047bf491b9 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PageConfigPanel/PageConfigPanel.test.tsx @@ -9,7 +9,7 @@ import { DEFAULT_LANGUAGE, DEFAULT_SELECTED_LAYOUT_NAME } from 'app-shared/const import { textMock } from '@studio/testing/mocks/i18nMock'; import type { IFormLayouts } from '../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data diff --git a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx index d83d9ed097a..720c11d8cc9 100644 --- a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx +++ b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/EditComponentIdRow/EditComponentIdRow.test.tsx @@ -9,7 +9,7 @@ import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import type { IFormLayouts } from '../../../../types/global'; import { QueryKey } from 'app-shared/types/QueryKey'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx index 8d76096a93b..7600a267937 100644 --- a/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/EditFormComponent.test.tsx @@ -9,7 +9,7 @@ import { ComponentType } from 'app-shared/types/ComponentType'; import { useDatamodelMetadataQuery } from '../../hooks/queries/useDatamodelMetadataQuery'; import type { DatamodelMetadataResponse } from 'app-shared/types/api'; import { componentMocks } from '../../testing/componentMocks'; -import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { dataModelNameMock, layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx index 28e950d8df9..e2c71b4bfae 100644 --- a/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/ExpressionContent/ExpressionContent.test.tsx @@ -4,7 +4,7 @@ import { parsableLogicalExpression } from '../../../testing/expressionMocks'; import { renderWithProviders } from '../../../testing/mocks'; import type { IFormLayouts } from '../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { ExpressionContentProps } from './ExpressionContent'; import { ExpressionContent } from './ExpressionContent'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; diff --git a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx index cf425db6926..d28047958dd 100644 --- a/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/Expressions/Expressions.test.tsx @@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event'; import { renderWithProviders } from '../../../testing/mocks'; import type { IFormLayouts } from '../../../types/global'; import { layout1NameMock, layoutMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; diff --git a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx index eed8b0463a7..8f780e3a22f 100644 --- a/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/SelectDataModelComponent.test.tsx @@ -9,7 +9,7 @@ import { getDataModelFieldsFilter } from '../../utils/datamodel'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; const dataModelName = undefined; diff --git a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx index d50aa03b753..b1f6a748aa8 100644 --- a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/Panel/PanelComponent.test.tsx @@ -15,7 +15,7 @@ import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLay import { textMock } from '@studio/testing/mocks/i18nMock'; import { FormPanelVariant } from 'app-shared/types/FormPanelVariant'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx index 07c2c8c4200..af178bd3658 100644 --- a/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/componentSpecificContent/RepeatingGroup/RepeatingGroupComponent.test.tsx @@ -10,7 +10,7 @@ import { layout1NameMock, layoutMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { queryClientMock } from 'app-shared/mocks/queryClientMock'; import type { IFormLayouts } from '../../../../types/global'; diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx index 9a70a302ac8..03e89d8cd23 100644 --- a/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx +++ b/frontend/packages/ux-editor/src/components/config/editModal/EditDataModelBindings/EditDataModelBindings.test.tsx @@ -11,7 +11,7 @@ import { QueryKey } from 'app-shared/types/QueryKey'; import { componentMocks } from '../../../../testing/componentMocks'; import type { FormItem } from '../../../../types/FormItem'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; const dataModelName = undefined; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx index 48456f479ed..3bde49dd736 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/DesignView.test.tsx @@ -16,7 +16,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { appContextMock } from '../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx index 9dba1b13f37..3ec41d1f671 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/FormTree/FormItem/FormItemTitle/FormItemTitle.test.tsx @@ -13,7 +13,7 @@ import { formItemContextProviderMock } from '../../../../../testing/formItemCont import { queriesMock } from 'app-shared/mocks/queriesMock'; import { app, org } from '@studio/testing/testids'; import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; const mockHandleDiscard = jest.fn(); diff --git a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx index 835920dd6dd..da18997e689 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/NavigationMenu/NavigationMenu.test.tsx @@ -12,7 +12,7 @@ import { } from '../../../../testing/mocks'; import { useFormLayoutSettingsQuery } from '../../../../hooks/queries/useFormLayoutSettingsQuery'; import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; const mockPageName1: string = layout1NameMock; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx index 5e15dc75909..b3a5523b195 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/PageAccordion/PageAccordion.test.tsx @@ -12,7 +12,7 @@ import { renderWithProviders, } from '../../../testing/mocks'; import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { queriesMock } from 'app-shared/mocks/queriesMock'; import { appContextMock } from '../../../testing/appContextMock'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx b/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx index 94e7e6795e4..6d005ba4ccf 100644 --- a/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx +++ b/frontend/packages/ux-editor/src/containers/DesignView/ReceiptContent/ReceiptContent.test.tsx @@ -11,7 +11,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { IInternalLayout } from '../../../types/global'; import { formLayoutSettingsMock, diff --git a/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx b/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx index 5ce081bf0d3..d94e2d51880 100644 --- a/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx +++ b/frontend/packages/ux-editor/src/containers/FormItemContext.test.tsx @@ -16,7 +16,7 @@ import { layoutMock, } from '../testing/layoutMock'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; const layoutName = layout1NameMock; const layoutSetName = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts index 5bd395e1add..88d1963c5dc 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddFormContainerMutation.test.ts @@ -7,7 +7,7 @@ import { useAddFormContainerMutation } from './useAddFormContainerMutation'; import type { FormContainer } from '../../types/FormContainer'; import { ComponentType } from 'app-shared/types/ComponentType'; import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts index 382a243f677..ad3f3016797 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddItemToLayoutMutation.test.ts @@ -11,7 +11,7 @@ import { layoutSet1NameMock, layoutSet2NameMock, layoutSetsMock, -} from '@altinn/ux-editor/testing/layoutSetMock'; +} from '@altinn/ux-editor/testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts index 661d3c9d291..414685905fb 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddLayoutMutation.test.ts @@ -7,7 +7,7 @@ import { waitFor } from '@testing-library/react'; import { useFormLayoutSettingsQuery } from '../queries/useFormLayoutSettingsQuery'; import { ComponentType } from 'app-shared/types/ComponentType'; import { externalLayoutsMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import type { ILayoutSettings } from 'app-shared/types/global'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts index 4679222b829..c6c2c310480 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useAddWidgetMutation.test.ts @@ -9,7 +9,7 @@ import { ComponentType } from 'app-shared/types/ComponentType'; import type { ITextResource } from 'app-shared/types/global'; import { useTextResourcesQuery } from 'app-shared/hooks/queries/useTextResourcesQuery'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts index 01b1a286993..20764041625 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormComponentMutation.test.ts @@ -4,7 +4,7 @@ import { waitFor } from '@testing-library/react'; import { useDeleteFormComponentMutation } from './useDeleteFormComponentMutation'; import { useFormLayoutsQuery } from '../queries/useFormLayoutsQuery'; import { component2IdMock, layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts index 465c8dd0403..97459568826 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteFormContainerMutation.test.ts @@ -9,7 +9,7 @@ import { externalLayoutsMock, layout1NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts index 83ac267d0eb..beff37994f0 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useDeleteLayoutMutation.test.ts @@ -7,7 +7,7 @@ import { layout1NameMock, layout2NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { QueryKey } from 'app-shared/types/QueryKey'; import { convertExternalLayoutsToInternalFormat } from '../../utils/formLayoutsUtils'; import { appContextMock } from '../../testing/appContextMock'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx index b1beb6a87d7..1004f586414 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutMutation.test.tsx @@ -5,7 +5,7 @@ import { useFormLayoutMutation } from './useFormLayoutMutation'; import type { IInternalLayout } from '../../types/global'; import { ComponentType } from 'app-shared/types/ComponentType'; import { baseContainerIdMock, layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts index 965e6acbc7c..25d1aab589f 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useFormLayoutSettingsMutation.test.ts @@ -3,7 +3,7 @@ import { formLayoutSettingsMock, renderHookWithProviders } from '../../testing/m import { useFormLayoutSettingsMutation } from './useFormLayoutSettingsMutation'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts index 7627ba4f4f1..6e8460244ef 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useRuleConfigMutation.test.ts @@ -3,7 +3,7 @@ import { renderHookWithProviders } from '../../testing/mocks'; import { useRuleConfigMutation } from './useRuleConfigMutation'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts index 33317afb330..3a8585eb266 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentMutation.test.ts @@ -9,7 +9,7 @@ import { externalLayoutsMock, layout1NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { FormCheckboxesComponent, FormComponent, diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts index a3e4d4c9089..63be70d86c7 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormComponentOrderMutation.test.ts @@ -14,7 +14,7 @@ import { layout1NameMock, layoutMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts index 8ffc345d39b..026f94d6b56 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateFormContainerMutation.test.ts @@ -12,7 +12,7 @@ import { layout1Mock, layout1NameMock, } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { ruleConfig as ruleConfigMock } from '../../testing/ruleConfigMock'; import type { FormLayoutsResponse } from 'app-shared/types/api'; import type { RuleConfig } from 'app-shared/types/RuleConfig'; diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts index 8e23f5fbf55..ee35d7776a8 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutNameMutation.test.ts @@ -6,7 +6,7 @@ import { waitFor } from '@testing-library/react'; import type { UpdateLayoutNameMutationArgs } from './useUpdateLayoutNameMutation'; import { useUpdateLayoutNameMutation } from './useUpdateLayoutNameMutation'; import { layout1NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts index ad9dcf2b0cc..274a4a1ae64 100644 --- a/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts +++ b/frontend/packages/ux-editor/src/hooks/mutations/useUpdateLayoutOrderMutation.test.ts @@ -5,7 +5,7 @@ import { waitFor } from '@testing-library/react'; import type { UpdateLayoutOrderMutationArgs } from './useUpdateLayoutOrderMutation'; import { useUpdateLayoutOrderMutation } from './useUpdateLayoutOrderMutation'; import { layout1NameMock, layout2NameMock } from '@altinn/ux-editor/testing/layoutMock'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; import { app, org } from '@studio/testing/testids'; // Test data: diff --git a/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts b/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts index b887afee23f..3d459f27f26 100644 --- a/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts +++ b/frontend/packages/ux-editor/src/hooks/queries/useRuleModelQuery.test.ts @@ -26,7 +26,7 @@ import ruleHandlerMock, { import { createQueryClientMock } from 'app-shared/mocks/queryClientMock'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts b/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts index c0e784d7ac0..150160e853d 100644 --- a/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useFormLayout.test.ts @@ -2,7 +2,7 @@ import { useFormLayout } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; import { externalLayoutsMock, layout1NameMock, layoutMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts b/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts index 98d030df180..4c75e7dc1d6 100644 --- a/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useFormLayouts.test.ts @@ -2,7 +2,7 @@ import { useFormLayouts } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; import { externalLayoutsMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { waitFor } from '@testing-library/react'; import { convertExternalLayoutsToInternalFormat } from '../utils/formLayoutsUtils'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts index 0a8bbfdffd9..7c7b366ea07 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayout.test.ts @@ -4,7 +4,7 @@ import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; import { externalLayoutsMock, layoutMock } from '../testing/layoutMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; -import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetMock'; +import { layoutSet1NameMock } from '@altinn/ux-editor/testing/layoutSetsMock'; // Test data: const selectedLayoutSet = layoutSet1NameMock; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx index d8f35d10f82..3a9cf526307 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutName.test.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedFormLayoutName } from './'; import { layout1NameMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { renderHook } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx index 58fe42ae38d..04f832f735f 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutSetName.test.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedFormLayoutSetName } from './'; -import { layoutSet1NameMock, layoutSetsMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock, layoutSetsMock } from '../testing/layoutSetsMock'; import { renderHook, waitFor } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts index 090af14ef15..fcac9abf3b2 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts +++ b/frontend/packages/ux-editor/src/hooks/useSelectedFormLayoutWithName.test.ts @@ -2,7 +2,7 @@ import { useSelectedFormLayoutWithName } from './'; import { renderHookWithProviders } from '../testing/mocks'; import { useFormLayoutsQuery } from './queries/useFormLayoutsQuery'; import { externalLayoutsMock, layoutMock, layout1NameMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { waitFor } from '@testing-library/react'; import { app, org } from '@studio/testing/testids'; diff --git a/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx b/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx index 91774c99f5c..1d2607a2971 100644 --- a/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx +++ b/frontend/packages/ux-editor/src/hooks/useSelectedTaskId.test.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import React from 'react'; import { useSelectedTaskId } from './'; import { layout1NameMock } from '../testing/layoutMock'; -import { layoutSet1NameMock } from '../testing/layoutSetMock'; +import { layoutSet1NameMock } from '../testing/layoutSetsMock'; import { renderHook } from '@testing-library/react'; import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; import { ServicesContextProvider } from 'app-shared/contexts/ServicesContext'; diff --git a/frontend/packages/ux-editor/src/testing/layoutSetMock.ts b/frontend/packages/ux-editor/src/testing/layoutSetsMock.ts similarity index 100% rename from frontend/packages/ux-editor/src/testing/layoutSetMock.ts rename to frontend/packages/ux-editor/src/testing/layoutSetsMock.ts From 71bf2c479a52d702c1c915f080336e7dcd1bb3f4 Mon Sep 17 00:00:00 2001 From: Erling Hauan Date: Tue, 28 May 2024 13:29:21 +0200 Subject: [PATCH 26/26] Rename layoutSetMock -> layoutSetsMock --- frontend/packages/ux-editor-v3/src/testing/appContextMock.ts | 2 +- frontend/packages/ux-editor-v3/src/testing/stateMocks.ts | 2 +- frontend/packages/ux-editor/src/testing/appContextMock.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts b/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts index 75ade196bc2..f6bc2ea625e 100644 --- a/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts +++ b/frontend/packages/ux-editor-v3/src/testing/appContextMock.ts @@ -1,6 +1,6 @@ import type { AppContextProps } from '../AppContext'; import type { RefObject } from 'react'; -import { layoutSet1NameMock } from './layoutSetMock'; +import { layoutSet1NameMock } from './layoutSetsMock'; const previewIframeRefMock: RefObject = { current: null, diff --git a/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts b/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts index e8a648f202d..d089e23b7d5 100644 --- a/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts +++ b/frontend/packages/ux-editor-v3/src/testing/stateMocks.ts @@ -2,7 +2,7 @@ import type { ITextResourcesState } from '../features/appData/textResources/text import type { IAppDataState } from '../features/appData/appDataReducers'; import type { IFormDesignerState } from '../features/formDesigner/formDesignerReducer'; import { layout1NameMock } from './layoutMock'; -import { layoutSet1NameMock } from './layoutSetMock'; +import { layoutSet1NameMock } from './layoutSetsMock'; import type { IAppState } from '../types/global'; export const textResourcesMock: ITextResourcesState = { diff --git a/frontend/packages/ux-editor/src/testing/appContextMock.ts b/frontend/packages/ux-editor/src/testing/appContextMock.ts index 630e6539067..918b4d3fa69 100644 --- a/frontend/packages/ux-editor/src/testing/appContextMock.ts +++ b/frontend/packages/ux-editor/src/testing/appContextMock.ts @@ -1,6 +1,6 @@ import type { AppContextProps } from '../AppContext'; import type { RefObject } from 'react'; -import { layoutSet1NameMock } from './layoutSetMock'; +import { layoutSet1NameMock } from './layoutSetsMock'; import { layout1NameMock } from './layoutMock'; const previewIframeRefMock: RefObject = {