Test changes
This commit is contained in:
@@ -47,7 +47,7 @@ func ResetTestDB(t *testing.T, tableName string) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContact(id uuid.UUID, userId uuid.UUID) contact.Contact {
|
||||
func ContactTest(id uuid.UUID, userId uuid.UUID) contact.Contact {
|
||||
if id == uuid.Nil {
|
||||
id = uuid.New()
|
||||
return contact.Contact{Id: &id, PhoneNumber: "+10123456789", UserId: &userId}
|
||||
@@ -56,15 +56,16 @@ func TestContact(id uuid.UUID, userId uuid.UUID) contact.Contact {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessage(id uuid.UUID, userId uuid.UUID) message.Message {
|
||||
func MessageTest(id uuid.UUID, userId uuid.UUID) message.Message {
|
||||
if id == uuid.Nil {
|
||||
return message.Message{Id: uuid.New(), Content: "Oh how the mighty have fallen", UserId: userId}
|
||||
id = uuid.New()
|
||||
return message.Message{Id: &id, Content: "Oh how the mighty have fallen", UserId: &userId}
|
||||
} else {
|
||||
return message.Message{Id: id, Content: "Oh how the mighty have fallen", UserId: userId}
|
||||
return message.Message{Id: &id, Content: "Oh how the mighty have fallen", UserId: &userId}
|
||||
}
|
||||
}
|
||||
|
||||
func TestScheduledMessage(id uuid.UUID, userId uuid.UUID, now time.Time) scheduling.ScheduledMessage {
|
||||
func ScheduledMessageTest(id uuid.UUID, userId uuid.UUID, now time.Time) scheduling.ScheduledMessage {
|
||||
if id == uuid.Nil {
|
||||
return scheduling.ScheduledMessage{Id: uuid.New(), UserId: userId, Scheduled: now.Add(20 * time.Minute), Status: scheduling.Pending}
|
||||
} else {
|
||||
@@ -72,11 +73,11 @@ func TestScheduledMessage(id uuid.UUID, userId uuid.UUID, now time.Time) schedul
|
||||
}
|
||||
}
|
||||
|
||||
func TestScheduledMessageEvent(messageId, contactId, scheduledMessageId uuid.UUID) scheduling.ScheduledMessageEvent {
|
||||
func ScheduledMessageEventTest(messageId, contactId, scheduledMessageId uuid.UUID) scheduling.ScheduledMessageEvent {
|
||||
return scheduling.ScheduledMessageEvent{MessageId: messageId, ContactId: contactId, ScheduledMessageId: scheduledMessageId}
|
||||
}
|
||||
|
||||
func TestMERResponseInString() string {
|
||||
func MERResponseInString() string {
|
||||
return `{
|
||||
"body": "Whoknows?",
|
||||
"num_segments": "0",
|
||||
@@ -98,7 +99,7 @@ func TestMERResponseInString() string {
|
||||
}`
|
||||
}
|
||||
|
||||
func TestConvertStringToMapOfAny(response string) (map[string]any, error) {
|
||||
func ConvertStringToMapOfAny(response string) (map[string]any, error) {
|
||||
bytes := []byte(response)
|
||||
var merResponse map[string]any
|
||||
err := json.Unmarshal(bytes, &merResponse)
|
||||
|
||||
Reference in New Issue
Block a user