More test changes

This commit is contained in:
phoenix
2026-01-01 14:01:58 -05:00
parent 57619759d5
commit f73c959830
3 changed files with 19 additions and 19 deletions
@@ -60,7 +60,7 @@ func TestRecordMessageEventResponseWithMock(t *testing.T) {
sent := now.Add(30 * time.Minute) sent := now.Add(30 * time.Minute)
var merResponse map[string]any var merResponse map[string]any
merResponse, err = TestConvertStringToMapOfAny(TestMERResponseInString()) merResponse, err = ConvertStringToMapOfAny(MERResponseInString())
assert.NoError(t, err, "Error Converting to map[string]any") assert.NoError(t, err, "Error Converting to map[string]any")
testReq := RecordEventRequest{ScheduledMessageEventId: event.Id, Response: merResponse, UserId: schMsg.UserId, Sent: &sent, Status: evnt.Message_Event_Response_Status_Scheduled} testReq := RecordEventRequest{ScheduledMessageEventId: event.Id, Response: merResponse, UserId: schMsg.UserId, Sent: &sent, Status: evnt.Message_Event_Response_Status_Scheduled}
@@ -132,7 +132,7 @@ func TestGetMessageEventResponse(t *testing.T) {
m.Status = evnt.Message_Event_Response_Status_Scheduled m.Status = evnt.Message_Event_Response_Status_Scheduled
m.Sent = sent m.Sent = sent
var merResponse map[string]any var merResponse map[string]any
merResponse, err = TestConvertStringToMapOfAny(TestMERResponseInString()) merResponse, err = ConvertStringToMapOfAny(MERResponseInString())
assert.NoError(t, err, "Error Converting to map[string]any") assert.NoError(t, err, "Error Converting to map[string]any")
m.Response = merResponse m.Response = merResponse
@@ -47,9 +47,9 @@ func TestCreateScheduledMessageEventWithMock(t *testing.T) {
scheduledMessageId := uuid.New() scheduledMessageId := uuid.New()
testUserId := uuid.New() testUserId := uuid.New()
con := TestContact(contactId, testUserId) con := ContactTest(contactId, testUserId)
msg := TestMessage(messageId, testUserId) msg := MessageTest(messageId, testUserId)
schMsg := TestScheduledMessage(scheduledMessageId, testUserId, now) schMsg := ScheduledMessageTest(scheduledMessageId, testUserId, now)
ctx := t.Context() ctx := t.Context()
@@ -99,10 +99,10 @@ func TestGetScheduledMessageEventWithMock(t *testing.T) {
scheduledMessageId := uuid.New() scheduledMessageId := uuid.New()
testUserId := uuid.New() testUserId := uuid.New()
con := TestContact(contactId, testUserId) con := ContactTest(contactId, testUserId)
msg := TestMessage(messageId, testUserId) msg := MessageTest(messageId, testUserId)
schMsg := TestScheduledMessage(scheduledMessageId, testUserId, now) schMsg := ScheduledMessageTest(scheduledMessageId, testUserId, now)
event := TestScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id) event := ScheduledMessageEventTest(*msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
@@ -145,10 +145,10 @@ func TestDeleteScheduledMessageEventWithMock(t *testing.T) {
assert.NoError(t, err, "Error getting app") assert.NoError(t, err, "Error getting app")
handler := NewScheduledMessageEventHandler(apiApp, schMsgEventStore, schMsgStore) handler := NewScheduledMessageEventHandler(apiApp, schMsgEventStore, schMsgStore)
con := TestContact(contactId, testUserId) con := ContactTest(contactId, testUserId)
msg := TestMessage(messageId, testUserId) msg := MessageTest(messageId, testUserId)
schMsg := TestScheduledMessage(scheduledMessageId, testUserId, now) schMsg := ScheduledMessageTest(scheduledMessageId, testUserId, now)
event := TestScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id) event := ScheduledMessageEventTest(*msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
+6 -6
View File
@@ -31,7 +31,7 @@ func TestCreateScheduledMessageWithMock(t *testing.T) {
handler := NewScheduledMessageHandler(apiApp, mockStore) handler := NewScheduledMessageHandler(apiApp, mockStore)
testUserId := uuid.New() testUserId := uuid.New()
testBody := testCreateScheduledMessageRequest(testUserId, now) testBody := createScheduledMessageRequest(testUserId, now)
jsonValue, _ := json.Marshal(testBody) jsonValue, _ := json.Marshal(testBody)
req, _ := http.NewRequest("POST", endpoint.ScheduleMessageEndpoint, strings.NewReader(string(jsonValue))) req, _ := http.NewRequest("POST", endpoint.ScheduleMessageEndpoint, strings.NewReader(string(jsonValue)))
@@ -94,10 +94,10 @@ func TestFetchScheduledMessageWithMock(t *testing.T) {
scheduledMessageId := uuid.New() scheduledMessageId := uuid.New()
testUserId := uuid.New() testUserId := uuid.New()
con := TestContact(contactId, testUserId) con := ContactTest(contactId, testUserId)
msg := TestMessage(messageId, testUserId) msg := MessageTest(messageId, testUserId)
schMsg := TestScheduledMessage(scheduledMessageId, testUserId, now) schMsg := ScheduledMessageTest(scheduledMessageId, testUserId, now)
event := TestScheduledMessageEvent(msg.Id, *con.Id, schMsg.Id) event := ScheduledMessageEventTest(*msg.Id, *con.Id, schMsg.Id)
ctx := t.Context() ctx := t.Context()
@@ -135,7 +135,7 @@ func TestFetchScheduledMessageWithMock(t *testing.T) {
assert.Equal(t, scheduling.Processing, fetchedSchMsg.Status, "The statuses do not match") assert.Equal(t, scheduling.Processing, fetchedSchMsg.Status, "The statuses do not match")
} }
func testCreateScheduledMessageRequest(userId uuid.UUID, now time.Time) CreateScheduledMessageRequest { func createScheduledMessageRequest(userId uuid.UUID, now time.Time) CreateScheduledMessageRequest {
scheduled := now.Add(5 * time.Minute) scheduled := now.Add(5 * time.Minute)
return CreateScheduledMessageRequest{Status: scheduling.Pending, UserId: userId, Scheduled: scheduled} return CreateScheduledMessageRequest{Status: scheduling.Pending, UserId: userId, Scheduled: scheduled}
} }