-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests, fix broken mappings, add missing properties to SO get/sear…
…ch DTOs
- Loading branch information
Showing
15 changed files
with
582 additions
and
118 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
94 changes: 94 additions & 0 deletions
94
...ten.Application.Integration.Tests/Features/V1/EndUser/Dialogs/Queries/ActivityLogTests.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,94 @@ | ||
using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Get; | ||
using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Search; | ||
using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Get; | ||
using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialogs.Commands.Create; | ||
using Digdir.Domain.Dialogporten.Application.Integration.Tests.Common; | ||
using Digdir.Domain.Dialogporten.Domain.Parties; | ||
using Digdir.Tool.Dialogporten.GenerateFakeData; | ||
using FluentAssertions; | ||
|
||
namespace Digdir.Domain.Dialogporten.Application.Integration.Tests.Features.V1.EndUser.Dialogs.Queries; | ||
|
||
[Collection(nameof(DialogCqrsCollectionFixture))] | ||
public class ActivityLogTests(DialogApplication application) : ApplicationCollectionFixture(application) | ||
{ | ||
[Fact] | ||
public async Task Get_Dialog_ActivityLog_Should_Not_Return_User_Ids_Unhashed() | ||
{ | ||
var (_, createCommandResponse) = await GenerateDialogWithActivity(); | ||
|
||
// Act | ||
var response = await Application.Send(new GetDialogQuery { DialogId = createCommandResponse.AsT0.Value }); | ||
|
||
// Assert | ||
response.TryPickT0(out var result, out _).Should().BeTrue(); | ||
result.Should().NotBeNull(); | ||
|
||
result.Activities | ||
.Single() | ||
.PerformedBy.ActorId | ||
.Should() | ||
.StartWith(NorwegianPersonIdentifier.HashPrefixWithSeparator); | ||
|
||
} | ||
|
||
[Fact] | ||
public async Task Search_Dialog_LatestActivity_Should_Not_Return_User_Ids_Unhashed() | ||
{ | ||
// Arrange | ||
var (createDialogCommand, _) = await GenerateDialogWithActivity(); | ||
|
||
// Act | ||
var response = await Application.Send(new SearchDialogQuery | ||
{ | ||
ServiceResource = [createDialogCommand.ServiceResource] | ||
}); | ||
|
||
// Assert | ||
response.TryPickT0(out var result, out _).Should().BeTrue(); | ||
result.Should().NotBeNull(); | ||
|
||
result.Items | ||
.Single() | ||
.LatestActivity! | ||
.PerformedBy.ActorId | ||
.Should() | ||
.StartWith(NorwegianPersonIdentifier.HashPrefixWithSeparator); | ||
} | ||
|
||
[Fact] | ||
public async Task Get_ActivityLog_Should_Not_Return_User_Ids_Unhashed() | ||
{ | ||
// Arrange | ||
var (_, createCommandResponse) = await GenerateDialogWithActivity(); | ||
|
||
var getDialogResult = await Application.Send(new GetDialogQuery { DialogId = createCommandResponse.AsT0.Value }); | ||
var activityId = getDialogResult.AsT0.Activities.First().Id; | ||
|
||
// Act | ||
var response = await Application.Send(new GetDialogActivityQuery() | ||
{ | ||
DialogId = createCommandResponse.AsT0.Value, | ||
ActivityId = activityId | ||
}); | ||
|
||
// Assert | ||
response.TryPickT0(out var result, out _).Should().BeTrue(); | ||
result.Should().NotBeNull(); | ||
|
||
result.PerformedBy.ActorId | ||
.Should() | ||
.StartWith(NorwegianPersonIdentifier.HashPrefixWithSeparator); | ||
} | ||
|
||
private async Task<(CreateDialogCommand, CreateDialogResult)> GenerateDialogWithActivity() | ||
{ | ||
var createDialogCommand = DialogGenerator.GenerateSimpleFakeDialog(); | ||
var activity = DialogGenerator.GenerateFakeDialogActivity(); | ||
activity.PerformedBy.ActorId = DialogGenerator.GenerateRandomParty(forcePerson: true); | ||
activity.PerformedBy.ActorName = null; | ||
createDialogCommand.Activities.Add(activity); | ||
var createCommandResponse = await Application.Send(createDialogCommand); | ||
return (createDialogCommand, createCommandResponse); | ||
} | ||
} |
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
Oops, something went wrong.