// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

package cli

import (
	"reflect"
	"testing"

	"tailscale.com/ipn/ipnstate"
)

func TestStatusExtraLines(t *testing.T) {
	t.Parallel()

	tests := []struct {
		name string
		st   *ipnstate.Status
		want []string
	}{
		{
			name: "nil",
			st:   nil,
			want: nil,
		},
		{
			name: "default upstream omitted",
			st:   &ipnstate.Status{},
			want: []string{},
		},
		{
			name: "self hosted target shown",
			st: &ipnstate.Status{
				NetworkLogTarget: "https://mirage.example.test",
			},
			want: []string{
				"# Network flow logs upload target: https://mirage.example.test",
			},
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := statusExtraLines(tt.st); !reflect.DeepEqual(got, tt.want) {
				t.Fatalf("statusExtraLines() = %#v, want %#v", got, tt.want)
			}
		})
	}
}
