Repository: Altinn/altinn-studio
Pull request #15366: fix: 404 error in app library caused by non-exisisting org-content repo
Author: login: ErlingHauan
Labels: name: quality/testing
description: Tests that are missing, needs to be created or could be improved.
name: backend
name: team/studio-domain1
name: skip-documentation
description: Issues where updating documentation is not relevant
Created: 2025-05-06T07:53:11Z | Merged: 2025-05-06T12:55:41Z

## Description

Endpoint `designer/api/{orgName}/content` now returns `204 No Content` if the `{orgName}-content` repo is not found.

## Related Issue(s)

- This PR

## Verification

- [x] **Your** code builds clean without any errors or warnings
- [x] Manual testing done (required)
- [x] Relevant automated test added (if you find this hard, leave it and we'll help out)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - The system now verifies the existence of an organization's content repository before retrieving content references, providing a clear response if absent.

- **Bug Fixes**
  - Enhanced handling and messaging for scenarios where the organization's content repository is missing.

- **Tests**
  - Added and refined tests to ensure proper responses and headers when content repositories are missing or organizations are invalid.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/backend/src/Designer/Controllers/Organisation/OrgContentController.cs b/backend/src/Designer/Controllers/Organisation/OrgContentController.cs
index cfa1490e505..ba124cea3ff 100644
--- a/backend/src/Designer/Controllers/Organisation/OrgContentController.cs
+++ b/backend/src/Designer/Controllers/Organisation/OrgContentController.cs
@@ -48,11 +48,17 @@ public async Task<ActionResult<List<LibraryContentReference>>> GetOrgLibraryCont
         cancellationToken.ThrowIfCancellationRequested();
         if (!await _orgService.IsOrg(orgName))
         {
-            HttpContext.Response.Headers["Reason"] = $"{orgName} is not a valid organisation.";
+            HttpContext.Response.Headers["Reason"] = $"{orgName} is not a valid organisation";
             return NoContent();
         }
 
         var editingContext = CreateAltinnOrgContext(orgName);
+        if (!_orgContentService.OrgContentRepoExists(editingContext))
+        {
+            HttpContext.Response.Headers["Reason"] = $"{orgName}-content repo does not exist";
+            return NoContent();
+        }
+
         if (string.IsNullOrEmpty(contentType))
         {
             return await _orgContentService.GetOrgContentReferences(null, editingContext, cancellationToken);
diff --git a/backend/src/Designer/Services/Implementation/OrgContentService.cs b/backend/src/Designer/Services/Implementation/OrgContentService.cs
index 6227875afc3..5a477e97e30 100644
--- a/backend/src/Designer/Services/Implementation/OrgContentService.cs
+++ b/backend/src/Designer/Services/Implementation/OrgContentService.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -13,15 +14,25 @@ namespace Altinn.Studio.Designer.Services.Implementation;
 /// <inheritdoc />
 public class OrgContentService : IOrgContentService
 {
+    private readonly IAltinnGitRepositoryFactory _altinnGitRepositoryFactory;
     private readonly IOrgCodeListService _orgCodeListService;
     private readonly IOrgTextsService _orgTextsService;
 
-    public OrgContentService(IOrgCodeListService orgCodeListService, IOrgTextsService orgTextsService)
+    public OrgContentService(IAltinnGitRepositoryFactory altinnGitRepositoryFactory, IOrgCodeListService orgCodeListService, IOrgTextsService orgTextsService)
     {
+        _altinnGitRepositoryFactory = altinnGitRepositoryFactory;
         _orgCodeListService = orgCodeListService;
         _orgTextsService = orgTextsService;
     }
 
+    /// <inheritdoc />
+    public bool OrgContentRepoExists(AltinnOrgContext context)
+    {
+        string contentRepoName = GetContentRepoName(context.Org);
+        string repoPath = _altinnGitRepositoryFactory.GetRepositoryPath(context.Org, contentRepoName, context.DeveloperName);
+        return Directory.Exists(repoPath);
+    }
+
     /// <inheritdoc />
     public async Task<List<LibraryContentReference>> GetOrgContentReferences(LibraryContentType? contentType, AltinnOrgContext context, CancellationToken cancellationToken = default)
     {
@@ -75,4 +86,9 @@ private static List<LibraryContentReference> CreateContentReferences(LibraryCont
     }
 
     private static string FormatContentSource(string orgName) => $"org.{orgName}";
+
+    private static string GetContentRepoName(string org)
+    {
+        return $"{org}-content";
+    }
 }
diff --git a/backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs b/backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs
index ce1e385e3dd..f535db0a0a7 100644
--- a/backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs
+++ b/backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs
@@ -30,5 +30,14 @@ public interface IAltinnGitRepositoryFactory
         /// <param name="repository">The name of the repository as specified in Gitea.</param>
         /// <param name="developer">The user name of the developer working on the repository.</param>
         AltinnOrgGitRepository GetAltinnOrgGitRepository(string org, string repository, string developer);
+
+        /// <summary>
+        /// Gets the full path to a repository.
+        /// </summary>
+        /// <param name="org">The organisation owning the repository, identified by its short name.</param>
+        /// <param name="repository">The name of the repository</param>
+        /// <param name="developer">The developer's user name associated with the repository.</param>
+        /// <returns>The full, OS-normalized path to the root directory of the repository.</returns>
+        string GetRepositoryPath(string org, string repository, string developer);
     }
 }
diff --git a/backend/src/Designer/Services/Interfaces/IOrgContentService.cs b/backend/src/Designer/Services/Interfaces/IOrgContentService.cs
index 71f66b70a88..08badcb89bf 100644
--- a/backend/src/Designer/Services/Interfaces/IOrgContentService.cs
+++ b/backend/src/Designer/Services/Interfaces/IOrgContentService.cs
@@ -20,4 +20,11 @@ public interface IOrgContentService
     /// <param name="cancellationToken">A token to observe cancellation requests.</param>
     /// <returns>A list of external content library resources.</returns>
     public Task<List<LibraryContentReference>> GetOrgContentReferences(LibraryContentType? contentType, AltinnOrgContext context, CancellationToken cancellationToken = default);
+
+    /// <summary>
+    /// Checks if the organisation's content repository exists in the specified context.
+    /// </summary>
+    /// <param name="context">The organisation context containing organisation and developer information.</param>
+    /// <returns>True if the content repository exists; otherwise, false.</returns>
+    public bool OrgContentRepoExists(AltinnOrgContext context);
 }
diff --git a/backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs b/backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
index 8f459bfe2bf..82a764d37f7 100644
--- a/backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
@@ -168,16 +168,36 @@ public async Task GetOrgContentReferences_GivenInvalidOrg_ShouldReturnNoContentW
 
         const string OrgName = "invalidOrgName";
         string apiBaseUrl = new Organisation(OrgName).ApiBaseUrl;
-        const LibraryContentType ResourceType = LibraryContentType.CodeList;
-        string apiUrlWithTextInvalidOrg = $"{apiBaseUrl}?contentType={ResourceType}";
-        using var request = new HttpRequestMessage(HttpMethod.Get, apiUrlWithTextInvalidOrg);
+        using var request = new HttpRequestMessage(HttpMethod.Get, apiBaseUrl);
+
+        // Act
+        var response = await HttpClient.SendAsync(request);
+
+        // Assert
+        Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
+        string reasonHeader = Assert.Single(response.Headers.GetValues("Reason"));
+        Assert.Equal($"{OrgName} is not a valid organisation", reasonHeader);
+
+        _orgServiceMock.Verify(service => service.IsOrg(OrgName), Times.Once);
+    }
+
+    [Fact]
+    public async Task GetOrgContentReferences_WhenContentRepoDoesNotExist_ShouldReturnNoContentWithHeaderMessage()
+    {
+        // Arrange
+        _orgServiceMock.Setup(service => service.IsOrg(It.IsAny<string>())).ReturnsAsync(true);
+
+        const string OrgName = "orgWithoutRepositories";
+        string apiBaseUrl = new Organisation(OrgName).ApiBaseUrl;
+        using var request = new HttpRequestMessage(HttpMethod.Get, apiBaseUrl);
 
         // Act
         var response = await HttpClient.SendAsync(request);
 
         // Assert
         Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
-        Assert.NotNull(response.Headers.GetValues("Reason"));
+        string reasonHeader = Assert.Single(response.Headers.GetValues("Reason"));
+        Assert.Equal($"{OrgName}-content repo does not exist", reasonHeader);
 
         _orgServiceMock.Verify(service => service.IsOrg(OrgName), Times.Once);
     }
diff --git a/backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs b/backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
index b8a3f392b68..a6bfabee2f5 100644
--- a/backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
+++ b/backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
@@ -4,6 +4,7 @@
 using Altinn.Studio.Designer.Enums;
 using Altinn.Studio.Designer.Models;
 using Altinn.Studio.Designer.Services.Implementation;
+using Altinn.Studio.Designer.Services.Interfaces;
 using Altinn.Studio.Designer.Services.Interfaces.Organisation;
 using Moq;
 using Xunit;
@@ -21,9 +22,10 @@ public class OrgContentServiceTests
 
     public OrgContentServiceTests()
     {
+        Mock<IAltinnGitRepositoryFactory> altinnGitRepositoryFactory = new();
         _mockOrgCodeListService = new Mock<IOrgCodeListService>();
         _mockOrgTextsService = new Mock<IOrgTextsService>();
-        _orgContentService = new OrgContentService(_mockOrgCodeListService.Object, _mockOrgTextsService.Object);
+        _orgContentService = new OrgContentService(altinnGitRepositoryFactory.Object, _mockOrgCodeListService.Object, _mockOrgTextsService.Object);
         _context = AltinnOrgContext.FromOrg(OrgName, DeveloperName);
     }
 


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs (1)</summary><blockquote>

`151-169`: **Good test coverage for missing repository scenario**

This new test properly covers the scenario where an organization exists but its content repository doesn't. The test structure follows the established patterns in the class.

Consider mocking the `OrgContentRepoExists` method to return false explicitly instead of relying on a specific organization name. This would make the test more resilient to environment changes.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 462622033fa32b1f156e551b2dbe98862c5399ee and 638aad243b1fee1c003c030900c76c146eee52f0.

</details>

<details>
<summary>📒 Files selected for processing (6)</summary>

* `backend/src/Designer/Controllers/Organisation/OrgContentController.cs` (1 hunks)
* `backend/src/Designer/Services/Implementation/OrgContentService.cs` (3 hunks)
* `backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs` (1 hunks)
* `backend/src/Designer/Services/Interfaces/IOrgContentService.cs` (1 hunks)
* `backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs` (1 hunks)
* `backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs` (2 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧬 Code Graph Analysis (1)</summary>

<details>
<summary>backend/src/Designer/Controllers/Organisation/OrgContentController.cs (2)</summary><blockquote>

<details>
<summary>backend/src/Designer/Services/Interfaces/IOrgContentService.cs (1)</summary>

* `OrgContentRepoExists` (29-29)

</details>
<details>
<summary>backend/src/Designer/Services/Implementation/OrgContentService.cs (1)</summary>

* `OrgContentRepoExists` (29-34)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (2)</summary>

* GitHub Check: Build environment and run e2e test
* GitHub Check: Testing

</details>

<details>
<summary>🔇 Additional comments (7)</summary><blockquote>

<details>
<summary>backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs (1)</summary>

`34-41`: **Interface addition looks good**

The new `GetRepositoryPath` method is well-documented with clear XML comments for its purpose, parameters, and return value. This addition properly supports the synchronous repository existence check requirement and aligns with the interface design pattern.

</details>
<details>
<summary>backend/src/Designer/Services/Interfaces/IOrgContentService.cs (1)</summary>

`24-29`: **Interface addition is well-defined**

The new `OrgContentRepoExists` method is properly documented with XML comments explaining its purpose, parameters, and return value. This addition fits well with the service's responsibility of handling organization content operations.

</details>
<details>
<summary>backend/src/Designer/Controllers/Organisation/OrgContentController.cs (1)</summary>

`56-60`: **Error handling improvement looks good**

The added repository existence check correctly implements the PR objective to return a 204 No Content response instead of a 404 error when the org-content repository doesn't exist. The response includes a descriptive reason header to inform the client about the specific cause.


This is a more graceful handling of the missing repository scenario that avoids exposing internal error details to clients while still providing useful information.

</details>
<details>
<summary>backend/src/Designer/Services/Implementation/OrgContentService.cs (3)</summary>

`17-17`: **Good implementation of dependency injection**

The new dependency `IAltinnGitRepositoryFactory` is properly injected through the constructor and correctly stored in a readonly field.



Also applies to: 21-26

---

`28-34`: **Clean implementation of repository existence check**

The `OrgContentRepoExists` method is well-implemented, using the factory to get the repository path and checking directory existence. This synchronous approach is appropriate since `Directory.Exists` is a synchronous operation.

---

`90-93`: **Good extraction of repository naming logic**

Extracting the repository naming logic into a private static helper method helps maintain consistency and avoids duplication.

</details>
<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs (1)</summary>

`139-149`: **Correctly updated test for invalid organization scenario**

The test has been appropriately updated to verify the new behavior where an invalid organization returns a 204 No Content response with a Reason header.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T09:26:34Z
user: login: ErlingHauan
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T09:55:26Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T09:56:35Z
user: login: Konrad-Simso
body: Very nice start! 
Both of the tests have a different `Reason` sent in their response, can we check that these are what we expect them to be?
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T10:10:55Z
user: login: Konrad-Simso
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T10:34:42Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 2**

<details>
<summary>♻️ Duplicate comments (1)</summary><blockquote>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs (1)</summary><blockquote>

`190-190`: **Fix naming convention violation**

Constants in C# should use PascalCase according to naming conventions. This is causing a format check failure in the pipeline.


```diff
-        const string orgName = "orgWithoutRepositories";
+        const string OrgName = "orgWithoutRepositories";
```

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: Format check</summary>

[failure] 190-190: 
Naming rule violation: These words must begin with upper case characters: orgName

</details>

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 3c218707ba4f5ad444115c147b98f8e233fee1b4 and 8d36e8bf1c0f3f9dd262805dbad124a29a78e946.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (2)</summary>

<details>
<summary>📓 Common learnings</summary>

```
Learnt from: ErlingHauan
PR: Altinn/altinn-studio#15366
File: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs:25-28
Timestamp: 2025-05-06T09:56:33.356Z
Learning: The OrgContentRepoExists method is already tested indirectly through the GetOrgContentReferencesTests integration tests that verify controller behavior when the method returns false.
```

</details>
<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs (1)</summary>

```
Learnt from: ErlingHauan
PR: Altinn/altinn-studio#15366
File: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs:25-28
Timestamp: 2025-05-06T09:56:33.356Z
Learning: The OrgContentRepoExists method is already tested indirectly through the GetOrgContentReferencesTests integration tests that verify controller behavior when the method returns false.
```

</details>

</details><details>
<summary>🪛 GitHub Check: Format check</summary>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs</summary>

[failure] 190-190: 
Naming rule violation: These words must begin with upper case characters: orgName

---

[failure] 169-169: 
Naming rule violation: These words must begin with upper case characters: orgName

</details>

</details>
<details>
<summary>🪛 GitHub Actions: Dotnet format check</summary>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs</summary>

[error] 169-169: Naming rule violation: These words must begin with upper case characters: orgName (IDE1006)

</details>

</details>
<details>
<summary>🪛 GitHub Actions: Build and Test on windows, linux and macos</summary>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs</summary>

[error] 202-202: CS0103: The name 'OrgName' does not exist in the current context.

</details>

</details>
<details>
<summary>🪛 GitHub Actions: Run gitea and db integration tests</summary>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs</summary>

[error] 202-202: CS0103: The name 'OrgName' does not exist in the current context.

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (2)</summary>

* GitHub Check: Build environment and run e2e test
* GitHub Check: Analyze

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs (1)</summary>

`177-201`: **Test implementation looks good**

The implementation of both tests correctly verifies the new behavior described in the PR. When the content repository doesn't exist, the API now returns a 204 No Content status with an appropriate reason header instead of a 404 error.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: Format check</summary>

[failure] 190-190: 
Naming rule violation: These words must begin with upper case characters: orgName

</details>

</details>

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T11:50:45Z
user: login: TomasEng
body: Testet OK i `dev`. Har verifisert at endepunktet responderer med 204 dersom jeg er ikke er logget inn som `ttd`, og at det ikke kommer noen feilmelding. Ser også at løsningen fortsatt fungerer som ventet for `ttd`. Glimrende!
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:49:37Z

Review comments:
diff_hunk: @@ -21,9 +22,10 @@ public class OrgContentServiceTests
 
     public OrgContentServiceTests()
     {
+        Mock<IAltinnGitRepositoryFactory> altinnGitRepositoryFactory = new();
         _mockOrgCodeListService = new Mock<IOrgCodeListService>();
         _mockOrgTextsService = new Mock<IOrgTextsService>();
-        _orgContentService = new OrgContentService(_mockOrgCodeListService.Object, _mockOrgTextsService.Object);
+        _orgContentService = new OrgContentService(altinnGitRepositoryFactory.Object, _mockOrgCodeListService.Object, _mockOrgTextsService.Object);
path: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Test updates look good, but test coverage could be expanded**

The constructor changes correctly add the required `IAltinnGitRepositoryFactory` mock to support the updated `OrgContentService`. However, I don't see any tests for the newly added `OrgContentRepoExists` method.


Consider adding a test case to verify the `OrgContentRepoExists` method's behavior, ensuring it returns the expected result based on whether the repository directory exists.

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs around lines 25 to 28, add a new test method to cover the OrgContentRepoExists method of OrgContentService. Mock the dependencies to simulate scenarios where the repository directory exists and does not exist, then assert that OrgContentRepoExists returns the correct boolean result in each case. This will expand test coverage and verify the new method's behavior.
```

</details>

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-05-06T09:26:33Z
author_association: CONTRIBUTOR
diff_hunk: @@ -21,9 +22,10 @@ public class OrgContentServiceTests
 
     public OrgContentServiceTests()
     {
+        Mock<IAltinnGitRepositoryFactory> altinnGitRepositoryFactory = new();
         _mockOrgCodeListService = new Mock<IOrgCodeListService>();
         _mockOrgTextsService = new Mock<IOrgTextsService>();
-        _orgContentService = new OrgContentService(_mockOrgCodeListService.Object, _mockOrgTextsService.Object);
+        _orgContentService = new OrgContentService(altinnGitRepositoryFactory.Object, _mockOrgCodeListService.Object, _mockOrgTextsService.Object);
path: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
user: login: ErlingHauan
body: Method is covered by GetOrgContentReferencesTests.
created_at: 2025-05-06T09:55:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -21,9 +22,10 @@ public class OrgContentServiceTests
 
     public OrgContentServiceTests()
     {
+        Mock<IAltinnGitRepositoryFactory> altinnGitRepositoryFactory = new();
         _mockOrgCodeListService = new Mock<IOrgCodeListService>();
         _mockOrgTextsService = new Mock<IOrgTextsService>();
-        _orgContentService = new OrgContentService(_mockOrgCodeListService.Object, _mockOrgTextsService.Object);
+        _orgContentService = new OrgContentService(altinnGitRepositoryFactory.Object, _mockOrgCodeListService.Object, _mockOrgTextsService.Object);
path: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs
user: login: coderabbitai[bot]
body: @ErlingHauan You're right - I see that the `GetOrgContentReferencesTests` class includes integration tests that verify the controller's behavior when `OrgContentRepoExists` returns false. This provides indirect coverage of the method from a usage perspective.

For simple methods like this one, this level of coverage is often sufficient, especially when the main goal is ensuring proper error handling in the controller. Your approach is pragmatic and avoids test duplication.

---

<details>
<summary>✏️ Learnings added</summary>

```
Learnt from: ErlingHauan
PR: Altinn/altinn-studio#15366
File: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs:25-28
Timestamp: 2025-05-06T09:56:33.356Z
Learning: The OrgContentRepoExists method is already tested indirectly through the GetOrgContentReferencesTests integration tests that verify controller behavior when the method returns false.
```

> Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings).

</details>




<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer>@ErlingHauan You're right - I see that the `GetOrgContentReferencesTests` class includes integration tests that verify the controller's behavior when `OrgContentRepoExists` returns false. This provides indirect coverage of the method from a usage perspective.

For simple methods like this one, this level of coverage is often sufficient, especially when the main goal is ensuring proper error handling in the controller. Your approach is pragmatic and avoids test duplication.

---

<details>
<summary>✏️ Learnings added</summary>

```
Learnt from: ErlingHauan
PR: Altinn/altinn-studio#15366
File: backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs:25-28
Timestamp: 2025-05-06T09:56:33.356Z
Learning: The OrgContentRepoExists method is already tested indirectly through the GetOrgContentReferencesTests integration tests that verify controller behavior when the method returns false.
```

> Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings).

</details>

</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-05-06T09:56:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -136,9 +136,27 @@ public async Task GetOrgContentReferences_GivenInvalidOrg_ShouldReturnNoContentW
 
         const string orgName = "invalidOrgName";
         string apiBaseUrl = new Organisation(orgName).ApiBaseUrl;
-        const LibraryContentType resourceType = LibraryContentType.CodeList;
-        string apiUrlWithTextInvalidOrg = $"{apiBaseUrl}?contentType={resourceType}";
-        using var request = new HttpRequestMessage(HttpMethod.Get, apiUrlWithTextInvalidOrg);
+        using var request = new HttpRequestMessage(HttpMethod.Get, apiBaseUrl);
+
+        // Act
+        var response = await HttpClient.SendAsync(request);
+
+        // Assert
+        Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
+        Assert.NotNull(response.Headers.GetValues("Reason"));
+
+        _orgServiceMock.Verify(service => service.IsOrg(orgName), Times.Once);
+    }
+
+    [Fact]
+    public async Task GetOrgContentReferences_WhenContentRepoDoesNotExist_ShouldReturnNoContent()
+    {
+        // Arrange
+        _orgServiceMock.Setup(service => service.IsOrg(It.IsAny<string>())).ReturnsAsync(true);
+
+        const string orgName = "org-without-repos";
path: backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
user: login: Konrad-Simso
body: Can this variable have the same naming convention as the `orgName` in the test above?
```suggestion
        const string orgName = "orgWithoutRepos";
```
created_at: 2025-05-06T10:03:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -166,20 +166,40 @@
         // Arrange
         _orgServiceMock.Setup(service => service.IsOrg(It.IsAny<string>())).ReturnsAsync(false);
 
-        const string OrgName = "invalidOrgName";
-        string apiBaseUrl = new Organisation(OrgName).ApiBaseUrl;
-        const LibraryContentType ResourceType = LibraryContentType.CodeList;
-        string apiUrlWithTextInvalidOrg = $"{apiBaseUrl}?contentType={ResourceType}";
-        using var request = new HttpRequestMessage(HttpMethod.Get, apiUrlWithTextInvalidOrg);
+        const string orgName = "invalidOrgName";
path: backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Fix naming convention violation**

Constants in C# should use PascalCase according to naming conventions. This is causing a format check failure in the pipeline.


```diff
-        const string orgName = "invalidOrgName";
+        const string OrgName = "invalidOrgName";
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
        const string OrgName = "invalidOrgName";
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: Format check</summary>

[failure] 169-169: 
Naming rule violation: These words must begin with upper case characters: orgName

</details>
<details>
<summary>🪛 GitHub Actions: Dotnet format check</summary>

[error] 169-169: Naming rule violation: These words must begin with upper case characters: orgName (IDE1006)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs at line 169, the constant orgName uses camelCase which violates C# naming conventions. Rename the constant to OrgName using PascalCase to comply with the standard and fix the format check failure.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit 263e4ef
created_at: 2025-05-06T11:50:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -166,20 +166,40 @@
         // Arrange
         _orgServiceMock.Setup(service => service.IsOrg(It.IsAny<string>())).ReturnsAsync(false);
 
-        const string OrgName = "invalidOrgName";
-        string apiBaseUrl = new Organisation(OrgName).ApiBaseUrl;
-        const LibraryContentType ResourceType = LibraryContentType.CodeList;
-        string apiUrlWithTextInvalidOrg = $"{apiBaseUrl}?contentType={ResourceType}";
-        using var request = new HttpRequestMessage(HttpMethod.Get, apiUrlWithTextInvalidOrg);
+        const string orgName = "invalidOrgName";
+        string apiBaseUrl = new Organisation(orgName).ApiBaseUrl;
+        using var request = new HttpRequestMessage(HttpMethod.Get, apiBaseUrl);
+
+        // Act
+        var response = await HttpClient.SendAsync(request);
+
+        // Assert
+        Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
+        string reasonHeader = Assert.Single(response.Headers.GetValues("Reason"));
+        Assert.Equal($"{orgName} is not a valid organisation", reasonHeader);
+
+        _orgServiceMock.Verify(service => service.IsOrg(orgName), Times.Once);
+    }
+
+    [Fact]
+    public async Task GetOrgContentReferences_WhenContentRepoDoesNotExist_ShouldReturnNoContentWithHeaderMessage()
+    {
+        // Arrange
+        _orgServiceMock.Setup(service => service.IsOrg(It.IsAny<string>())).ReturnsAsync(true);
+
+        const string orgName = "orgWithoutRepositories";
+        string apiBaseUrl = new Organisation(orgName).ApiBaseUrl;
+        using var request = new HttpRequestMessage(HttpMethod.Get, apiBaseUrl);
 
         // Act
         var response = await HttpClient.SendAsync(request);
 
         // Assert
         Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
-        Assert.NotNull(response.Headers.GetValues("Reason"));
+        string reasonHeader = Assert.Single(response.Headers.GetValues("Reason"));
+        Assert.Equal($"{orgName}-content repo does not exist", reasonHeader);
 
         _orgServiceMock.Verify(service => service.IsOrg(OrgName), Times.Once);
path: backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Fix reference to undefined variable**

Line 202 is referencing `OrgName` which doesn't exist in this context, causing build failures. You should use the local variable defined on line 190 instead.


```diff
-        _orgServiceMock.Verify(service => service.IsOrg(OrgName), Times.Once);
+        _orgServiceMock.Verify(service => service.IsOrg(OrgName), Times.Once);
```

Note: After renaming `orgName` to `OrgName` in line 190 as suggested in the previous comment, this line will work correctly.


> Committable suggestion skipped: line range outside the PR's diff.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: Run dotnet build and test (macos-latest)</summary>

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

---

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

</details>
<details>
<summary>🪛 GitHub Check: Run integration tests against actual gitea and dbs</summary>

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

---

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

</details>
<details>
<summary>🪛 GitHub Check: Run dotnet build and test (ubuntu-latest)</summary>

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

---

[failure] 202-202: 
The name 'OrgName' does not exist in the current context

</details>
<details>
<summary>🪛 GitHub Actions: Build and Test on windows, linux and macos</summary>

[error] 202-202: CS0103: The name 'OrgName' does not exist in the current context.

</details>
<details>
<summary>🪛 GitHub Actions: Run gitea and db integration tests</summary>

[error] 202-202: CS0103: The name 'OrgName' does not exist in the current context.

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs at line 202, the variable OrgName is referenced but not defined, causing build errors. Rename the local variable declared at line 190 from orgName to OrgName to match the usage at line 202, ensuring consistent casing and scope so the Verify call works correctly.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit 263e4ef
created_at: 2025-05-06T11:50:44Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-05-06T07:53:17Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

```markdown
## Walkthrough

A repository existence check was added to the organization content retrieval flow. The `OrgContentService` and its interface now expose a method to verify if an organization's content repository exists, and the controller uses this check to return a `NoContent` response with a reason header if the repository is missing. Related tests and interfaces were updated accordingly.

## Changes

| File(s)                                                                                       | Change Summary                                                                                                                                                                                                                                                                                                                                                                                                         |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| backend/src/Designer/Controllers/Organisation/OrgContentController.cs                        | Added a check in `GetOrgLibraryContentReferences` to verify the existence of the organization's content repository before proceeding, returning `NoContent` with a reason header if missing.                                                                                                                                            |
| backend/src/Designer/Services/Implementation/OrgContentService.cs                            | Added dependency on `IAltinnGitRepositoryFactory`. Introduced `OrgContentRepoExists` method to check for repository existence, including a helper for repo naming. Updated constructor.                                                                                                                                                |
| backend/src/Designer/Services/Interfaces/IAltinnGitRepositoryFactory.cs                      | Added `GetRepositoryPath` method to interface for retrieving the repository's filesystem path.                                                                                                                                                                                                                                          |
| backend/src/Designer/Services/Interfaces/IOrgContentService.cs                               | Added `OrgContentRepoExists` method to interface for repository existence checking.                                                                                                                                                                                                                                                     |
| backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs | Modified existing test to adapt to new repo existence check and added a new test for the scenario where the content repo does not exist.                                                                                                                                                                                               |
| backend/tests/Designer.Tests/Services/OrgContentServiceTests.cs                              | Updated test setup to mock and inject the new `IAltinnGitRepositoryFactory` dependency required by `OrgContentService`.                                                                                                                                                                                                                 |

## Possibly related PRs

- [Altinn/altinn-studio#15203](https://github.com/Altinn/altinn-studio/pull/15203): Adds organization validation to the same controller method; related as both PRs add validation layers to the org content retrieval flow.

## Suggested labels

`skip-releasenotes`, `skip-manual-testing`

## Suggested reviewers

- TomasEng
```

</details>

<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 8d36e8bf1c0f3f9dd262805dbad124a29a78e946 and 263e4effaafc433d1c16bb939d7a97761bb6ba04.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* backend/tests/Designer.Tests/Controllers/OrgContentController/GetOrgContentReferencesTests.cs

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (6)</summary>

* GitHub Check: Build environment and run e2e test
* GitHub Check: Run dotnet build and test (macos-latest)
* GitHub Check: Run dotnet build and test (windows-latest)
* GitHub Check: Run dotnet build and test (ubuntu-latest)
* GitHub Check: Run integration tests against actual gitea and dbs
* GitHub Check: Analyze

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4AFgAGZMhKCnw+eCw0bm5IL3gBKhdGNGxEKLlIDHwMMBIEpCRxDCJ+CiIwJgwaAb8Sbnxo9Fpaf0Qa5EwUGeDIAHdYSg9cNcyMWlG80IADJUR4InIKAHoC+AuAbxyiADk0NgBfC/7B3APh3GwKcj0NCQNIZLI5FCxMJbA73HrPN59RpfH7+UYnAgVWjwegNUItdoaGBbBiwTCkSDMRTweLSaEeMi7fD7SACEhkiTwCGIfDQ6goUINZa/f4YOaQA4AJnSkEevIAwsj2D9ELhqNUUGKaGh6KsyPSJXCni8SK8kQNlcNRgt6vhQrF8NgdkT3NY7HkGF5sMdIFIKDT4AxqFysKqRsh+vEKMw8l1NvzNh4mEpWdh4F5aBHIpgvPJlupYI78RRshRkBDls4MLHEAAaSmYbBoXw0VWxyBkmQkfVMZjcSI0Wj1zD0fyRCSYUJVAjMahRVu4ZAcjxs/U6pS0F1bWw2nHsANRNDIDCONl8ACMAFYAMwANlv6B2KyP9mwAhjuEHrPkicg1UokAAKIUCUnQABJVJgGjmJYiqsOwyAOE4LhuCSLBsAM5ZYL+3DeL4/hB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HPlJKKESbvnqUaE/lKZ3XepqaVaorqbXU6bNprwGrc2pR9V/j6aGaOLGYjVtrCioyhAbFPZPy4D7EJ7zVJ7rmV4rX5UxzOzbAqFazmRNW+zoTsABxoBBzFGhxWw0I2xuRRwOxOxqwGzqBMI4gNHLRiy0BMLdqSa22xxQC3jXgAAcaAOokoyQ14Ag547MJA54DAqQqQ14Md14qQAAnLHQwAAOy3gMDnjJC3jdgkCXiSixCpDe1a3x2Sjnj+1p2pBp1czJCxCXg6jJBN3nhXhZ3JA11J3+2xD+0kCSjXjXiR3ngCAZAqxa3+20B3gkD+0CCxDR2pCxAD1J2TCSi3iSj+2pCXicw6jngh1oCShJ1oBp091J050l320r3XgkDJAXwaJoCxAMCh3Xi0DR3ni3iqBJ3XhL1p1oBJ1p0Z1D0CBv1oAyia322jSO3O1MKu10BMIaz6BAA= -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Altinn/altinn-studio&utm_content=15366):

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

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

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

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

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

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: ErlingHauan
created_at: 2025-05-06T09:24:01Z
body: @coderabbitai review
author_association: CONTRIBUTOR
user: login: coderabbitai[bot]
created_at: 2025-05-06T09:24:05Z
body: <!-- This is an auto-generated reply by CodeRabbit -->
<details>
<summary>✅ Actions performed</summary>

Review triggered.

> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

</details>
author_association: CONTRIBUTOR
user: login: codecov[bot]
created_at: 2025-05-06T09:26:19Z
body: ## [Codecov](https://app.codecov.io/gh/Altinn/altinn-studio/pull/15366?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Altinn) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 96.05%. Comparing base [(`bd4b715`)](https://app.codecov.io/gh/Altinn/altinn-studio/commit/bd4b71513724485de0c46de30d9a3de61aa45c06?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Altinn) to head [(`26af83d`)](https://app.codecov.io/gh/Altinn/altinn-studio/commit/26af83d4ccf7b6cbf3f970542147af497508e6f5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Altinn).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main   #15366   +/-   ##
=======================================
  Coverage   96.05%   96.05%           
=======================================
  Files        2066     2066           
  Lines       26648    26648           
  Branches     3002     3002           
=======================================
  Hits        25598    25598           
  Misses        786      786           
  Partials      264      264           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/Altinn/altinn-studio/pull/15366?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Altinn).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Altinn).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
author_association: NONE
user: login: TomasEng
created_at: 2025-05-06T11:23:31Z
body: Jeg kan teste denne, men kan du fikse konflikten først, @ErlingHauan?
author_association: CONTRIBUTOR