app/email/email_test.go

99 lines
2.1 KiB
Go
Raw Normal View History

2021-12-17 05:13:31 +00:00
package email
import (
"testing"
)
2021-12-17 06:18:31 +00:00
func TestSendSimple(t *testing.T) {
setupDefault()
err := Send("test@kumoly.io",
[]string{"test@kumoly.io"}, "TestSendSimple",
&Body{
Content: `Testing`,
2021-12-24 05:31:33 +00:00
Actions: []Action{
{Instructions: "click",
Button: Button{
Text: "click me", Link: "kumoly.io",
},
},
{Instructions: "long button",
Button: Button{
Text: `long long
longlonglonglonglonglonglonglonglonglong
longlonglonglonglonglonglonglonglonglong
longlonglonglonglonglonglonglonglonglong
text`,
Link: "kumoly.io",
Color: "#90CAF9",
TextColor: "#000000",
},
},
{Instructions: "None",
Button: Button{},
},
{Instructions: "click",
InviteCode: "12354",
},
},
2021-12-17 06:18:31 +00:00
},
)
if err != nil {
t.Error(err)
}
}
2021-12-17 05:13:31 +00:00
func TestSend(t *testing.T) {
2021-12-17 06:18:31 +00:00
setupDefault()
2021-12-17 05:13:31 +00:00
err := Send("test@kumoly.io",
2021-12-17 06:18:31 +00:00
[]string{"test@kumoly.io"}, "TestSend",
2021-12-17 05:13:31 +00:00
&Body{
2021-12-29 02:28:09 +00:00
App: App{
Logo: "https://www.taishinlife.com.tw/assets/images/ui/site-header/taishin/logo.svg",
Theme: "#d70c18",
FooterColor: "#ffffff",
},
2021-12-17 06:18:31 +00:00
Greeting: "歡迎",
Intros: []string{"testing 1.", "loramipsum...."},
Outros: []string{"testing 2,", "blah blah blah..."},
2021-12-24 06:00:55 +00:00
Actions: []Action{{Button: Button{Text: "click"}}},
2021-12-17 05:13:31 +00:00
Content: `
# Testing
2021-12-24 06:00:55 +00:00
| A | B | C |
| :------:| :-----------: | :-----------: |
| test |||
|| is ||
||| up |`,
2021-12-17 05:13:31 +00:00
},
)
if err != nil {
t.Error(err)
}
}
2021-12-17 06:18:31 +00:00
func TestMaintain(t *testing.T) {
setupDefault()
err := Send("test@kumoly.io",
[]string{"test@kumoly.io"}, "TestMaintain",
&Body{
Greeting: "您好",
Receiver: "管理員",
Sender: "App System",
Content: `
> _Hermes_ service will shutdown the **1st August 2017** for maintenance operations.
Services will be unavailable based on the following schedule:
| Services | Downtime |
| :------:| :-----------: |
| Service A | 2AM to 3AM |
| Service B | 4AM to 5AM |
| Service C | 5AM to 6AM |
Feel free to contact us for any question regarding this matter at [support@hermes-example.com](mailto:support@hermes-example.com) or in our [Gitter](https://gitter.im/)
`,
},
)
if err != nil {
t.Error(err)
}
}