Test fixes

This commit is contained in:
phoenix
2025-12-22 17:52:45 -05:00
parent fb17c02f69
commit 14f50a118f
5 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ func TestGetContactWithMock(t *testing.T) {
mockstore := mock.NewMockContactStore() mockstore := mock.NewMockContactStore()
testUserId := uuid.New() testUserId := uuid.New()
testCon := contact.Contact{PhoneNumber: "+12335403383", UserId: testUserId} testCon := contact.Contact{PhoneNumber: "+12335403383", UserId: &testUserId}
ctx := t.Context() ctx := t.Context()
if err := mockstore.CreateContact(ctx, &testCon); err != nil { if err := mockstore.CreateContact(ctx, &testCon); err != nil {
assert.NoError(t, err, "Error creating contact") assert.NoError(t, err, "Error creating contact")
@@ -51,7 +51,7 @@ func TestRecordMessageEventResponseWithMock(t *testing.T) {
} }
event.MessageId = msg.Id event.MessageId = msg.Id
event.RecipientId = con.Id event.RecipientId = *con.Id
event.ScheduledMessageId = schMsg.Id event.ScheduledMessageId = schMsg.Id
if err := mockStore.CreateScheduledMessageEvent(ctx, &event); err != nil { if err := mockStore.CreateScheduledMessageEvent(ctx, &event); err != nil {
assert.NoError(t, err, "Error creating scheduled message event: %v", err) assert.NoError(t, err, "Error creating scheduled message event: %v", err)
@@ -32,7 +32,7 @@ func TestUpdateScheduledMessageStatusWithMock(t *testing.T) {
con := testContact(recipientId, testUserId) con := testContact(recipientId, testUserId)
msg := testMessage(messageId, testUserId) msg := testMessage(messageId, testUserId)
schMsg := testScheduledMessage(scheduledMessageId, testUserId, now) schMsg := testScheduledMessage(scheduledMessageId, testUserId, now)
event := testScheduledMessageEvent(msg.Id, con.Id, schMsg.Id) event := testScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
@@ -104,7 +104,7 @@ func TestGetScheduledMessageEventWithMock(t *testing.T) {
con := testContact(recipientId, testUserId) con := testContact(recipientId, testUserId)
msg := testMessage(messageId, testUserId) msg := testMessage(messageId, testUserId)
schMsg := testScheduledMessage(scheduledMessageId, testUserId, now) schMsg := testScheduledMessage(scheduledMessageId, testUserId, now)
event := testScheduledMessageEvent(msg.Id, con.Id, schMsg.Id) event := testScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
@@ -150,7 +150,7 @@ func TestDeleteScheduledMessageEventWithMock(t *testing.T) {
con := testContact(recipientId, testUserId) con := testContact(recipientId, testUserId)
msg := testMessage(messageId, testUserId) msg := testMessage(messageId, testUserId)
schMsg := testScheduledMessage(scheduledMessageId, testUserId, now) schMsg := testScheduledMessage(scheduledMessageId, testUserId, now)
event := testScheduledMessageEvent(msg.Id, con.Id, schMsg.Id) event := testScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
@@ -185,9 +185,10 @@ func TestDeleteScheduledMessageEventWithMock(t *testing.T) {
func testContact(id uuid.UUID, userId uuid.UUID) contact.Contact { func testContact(id uuid.UUID, userId uuid.UUID) contact.Contact {
if id == uuid.Nil { if id == uuid.Nil {
return contact.Contact{Id: uuid.New(), PhoneNumber: "+10123456789", UserId: userId} id = uuid.New()
return contact.Contact{Id: &id, PhoneNumber: "+10123456789", UserId: &userId}
} else { } else {
return contact.Contact{Id: id, PhoneNumber: "+10123456789", UserId: userId} return contact.Contact{Id: &id, PhoneNumber: "+10123456789", UserId: &userId}
} }
} }
+1 -1
View File
@@ -97,7 +97,7 @@ func TestFetchScheduledMessageWithMock(t *testing.T) {
con := testContact(recipientId, testUserId) con := testContact(recipientId, testUserId)
msg := testMessage(messageId, testUserId) msg := testMessage(messageId, testUserId)
schMsg := testScheduledMessage(scheduledMessageId, testUserId, now) schMsg := testScheduledMessage(scheduledMessageId, testUserId, now)
event := testScheduledMessageEvent(msg.Id, con.Id, schMsg.Id) event := testScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()