feat(push): add service-owned firebase channels and delivery
Add push contracts, provider delivery and channel diagnostics. Link email channels to services and document migration and validation. Ref: IT-1074
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace HrynCo.NotificationService.Services.Tests.Push;
|
||||
|
||||
using HrynCo.NotificationService.Contracts.Messages;
|
||||
using HrynCo.NotificationService.Worker;
|
||||
using HrynCo.NotificationService.Worker.Services.Push;
|
||||
using Hrynco.RabbitMq;
|
||||
|
||||
public sealed class SendPushDeliveryValidatorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Notification.SendPush.v1", true)]
|
||||
[InlineData("Notification.SendEmail.v1", false)]
|
||||
[InlineData("Notification.SendPush.v2", false)]
|
||||
[InlineData("notification.sendpush.v1", false)]
|
||||
[InlineData("Notification.SendPush.v1 ", false)]
|
||||
[InlineData("SendPushV1", false)]
|
||||
[InlineData("1", false)]
|
||||
[InlineData("", false)]
|
||||
[InlineData(null, false)]
|
||||
public void AcceptsOnlyTheExistingPushWireContract(string? wireType, bool expected)
|
||||
{
|
||||
var id = Guid.NewGuid().ToString("D");
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var message = new SendPushMessage
|
||||
{
|
||||
CorrelationContext = new CorrelationContext { CorrelationId = id },
|
||||
Data = new SendPushMessageData
|
||||
{
|
||||
RegistrationId = Guid.NewGuid(), BindingId = Guid.NewGuid(), UserId = Guid.NewGuid(),
|
||||
ServiceName = "Invemory", Title = "Test", Body = "Test", Token = "test-device-token",
|
||||
TokenHash = new string('a', 64), ExpiresAt = now.AddMinutes(10)
|
||||
}
|
||||
};
|
||||
var context = new RabbitMqMessageContext
|
||||
{
|
||||
QueueName = "notification.send-push", RoutingKey = "notification.send-push", Exchange = "",
|
||||
MessageId = id, MessageType = wireType
|
||||
};
|
||||
|
||||
Assert.Equal(expected, SendPushDeliveryValidator.IsValid(message, context));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user