File: tracker_options_test.go

package info (click to toggle)
golang-gitlab-gitlab-org-labkit 1.17.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: sh: 210; javascript: 49; makefile: 4
file content (38 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package errortracking

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func Test_applyTrackerOptions(t *testing.T) {
	tests := []struct {
		name string
		opts []TrackerOption
		want trackerConfig
	}{
		{
			name: "with-all-options",
			opts: []TrackerOption{
				WithSentryDSN("dsn"),
				WithVersion("ver"),
				WithSentryEnvironment("env"),
				WithLoggerName("test-logger"),
			},
			want: trackerConfig{
				sentryDSN:         "dsn",
				version:           "ver",
				sentryEnvironment: "env",
				loggerName:        "test-logger",
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			got := applyTrackerOptions(tt.opts)

			require.Equalf(t, got, tt.want, "applyTrackerOptions() = %v, want %v", got, tt.want)
		})
	}
}