1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-07 05:58:13 -05:00

Nullable Test Fixup

This commit is contained in:
Justin Baur 2025-03-04 15:53:31 -05:00
parent 69c6436fd3
commit 1e13250292
No known key found for this signature in database

View File

@ -1,4 +1,6 @@
using System.IdentityModel.Tokens.Jwt; #nullable enable
using System.IdentityModel.Tokens.Jwt;
using System.Net; using System.Net;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Text.Json; using System.Text.Json;
@ -441,7 +443,7 @@ public class RelayPushNotificationServiceTests
{ {
var userId = Guid.NewGuid(); var userId = Guid.NewGuid();
JsonNode identifier = excludeCurrentContext ? _deviceIdentifier : null; JsonNode? identifier = excludeCurrentContext ? _deviceIdentifier : null;
var expectedPayload = new JsonObject var expectedPayload = new JsonObject
{ {
@ -646,7 +648,7 @@ public class RelayPushNotificationServiceTests
RevisionDate = DateTime.UtcNow, RevisionDate = DateTime.UtcNow,
}; };
JsonNode installationId = global ? _globalSettings.Installation.Id : null; JsonNode? installationId = global ? _globalSettings.Installation.Id : null;
var expectedPayload = new JsonObject var expectedPayload = new JsonObject
{ {
@ -707,7 +709,7 @@ public class RelayPushNotificationServiceTests
DeletedDate = DateTime.UtcNow, DeletedDate = DateTime.UtcNow,
}; };
JsonNode installationId = global ? _globalSettings.Installation.Id : null; JsonNode? installationId = global ? _globalSettings.Installation.Id : null;
var expectedPayload = new JsonObject var expectedPayload = new JsonObject
{ {
@ -900,13 +902,7 @@ public class RelayPushNotificationServiceTests
var actualString = JsonSerializer.Serialize(jsonContent.Value); var actualString = JsonSerializer.Serialize(jsonContent.Value);
var actualNode = JsonNode.Parse(actualString); var actualNode = JsonNode.Parse(actualString);
if (!JsonNode.DeepEquals(actualNode, expectedRequestBody)) return JsonNode.DeepEquals(actualNode, expectedRequestBody);
{
Assert.Equal(expectedRequestBody.ToJsonString(), actualNode.ToJsonString());
return false;
}
return true;
}) })
.Respond(HttpStatusCode.OK); .Respond(HttpStatusCode.OK);