You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
891 B
42 lines
891 B
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package ipn
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"tailscale.com/health"
|
|
"tailscale.com/types/empty"
|
|
)
|
|
|
|
func TestNotifyString(t *testing.T) {
|
|
for _, tt := range []struct {
|
|
name string
|
|
value Notify
|
|
expected string
|
|
}{
|
|
{
|
|
name: "notify-empty",
|
|
value: Notify{},
|
|
expected: "Notify{}",
|
|
},
|
|
{
|
|
name: "notify-with-login-finished",
|
|
value: Notify{LoginFinished: &empty.Message{}},
|
|
expected: "Notify{LoginFinished}",
|
|
},
|
|
{
|
|
name: "notify-with-multiple-fields",
|
|
value: Notify{LoginFinished: &empty.Message{}, Health: &health.State{}},
|
|
expected: "Notify{LoginFinished Health{...}}",
|
|
},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
actual := tt.value.String()
|
|
if actual != tt.expected {
|
|
t.Fatalf("expected=%q, actual=%q", tt.expected, actual)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|