-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
104 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
backend/tests/Designer.Tests/Controllers/PreviewController/GetFooterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.IO; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Models; | ||
using Designer.Tests.Utils; | ||
using FluentAssertions; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using SharedResources.Tests; | ||
using Xunit; | ||
|
||
namespace Designer.Tests.Controllers.PreviewController | ||
{ | ||
public class GetFooterTests : PreviewControllerTestsBase<GetFooterTests>, IClassFixture<WebApplicationFactory<Program>> | ||
{ | ||
public GetFooterTests(WebApplicationFactory<Program> factory) : base(factory) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task Get_Footer_Exists_Ok() | ||
{ | ||
string expectedFooter = TestDataHelper.GetFileFromRepo(Org, AppV4, Developer, "App/ui/footer.json"); | ||
FooterFile actualFooter = JsonSerializer.Deserialize<FooterFile>(expectedFooter); | ||
|
||
string dataPathWithData = $"{Org}/{AppV4}/api/v1/footer"; | ||
using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); | ||
|
||
using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); | ||
Assert.Equal(HttpStatusCode.OK, response.StatusCode); | ||
|
||
string responseString = await response.Content.ReadAsStringAsync(); | ||
FooterFile responseFooter = JsonSerializer.Deserialize<FooterFile>(responseString); | ||
|
||
responseFooter.Footer.Should().BeEquivalentTo(actualFooter.Footer); | ||
} | ||
|
||
[Fact] | ||
public async Task Get_Footer_Non_Existing_Ok() | ||
{ | ||
string dataPathWithData = $"{Org}/{AppV3}/api/v1/footer"; | ||
using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); | ||
|
||
using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); | ||
Assert.Equal(HttpStatusCode.OK, response.StatusCode); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...Designer.Tests/_TestData/Repositories/testUser/ttd/app-with-layoutsets/App/ui/footer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/footer.schema.v1.json", | ||
"footer": [ | ||
{ | ||
"type": "Link", | ||
"icon": "information", | ||
"title": "general.accessibility", | ||
"target": "general.accessibility_url" | ||
} | ||
] | ||
} |