diff options
Diffstat (limited to 'notif_config_test.go')
| -rw-r--r-- | notif_config_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/notif_config_test.go b/notif_config_test.go new file mode 100644 index 0000000..b7990b1 --- /dev/null +++ b/notif_config_test.go @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-3.0-only +// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> + +package lilin + +import ( + "testing" + + "git.sr.ht/~shulhan/pakakeh.go/lib/test" +) + +func TestNotifConfig_init(t *testing.T) { + listCase := []struct { + expError string + config NotifConfig + }{{ + config: NotifConfig{ + Kind: notifKindSMTP, + }, + expError: `notifConfig.init: smtp: empty user`, + }, { + config: NotifConfig{ + Kind: notifKindSMTP, + User: `john.doe@example.local`, + }, + expError: `notifConfig.init: smtp: empty password`, + }, { + config: NotifConfig{ + Kind: notifKindSMTP, + User: `john.doe@example.local`, + Password: `dummy`, + }, + expError: `notifConfig.init: smtp: empty recipient`, + }, { + config: NotifConfig{ + Kind: notifKindSMTP, + User: `john.doe@example.local`, + Password: `dummy`, + Recipient: []string{ + `jane.doe@example.local`, + }, + }, + }} + for _, tc := range listCase { + err := tc.config.init() + if err != nil { + test.Assert(t, ``, tc.expError, err.Error()) + continue + } + } +} |
