File: capture_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 (33 lines) | stat: -rw-r--r-- 882 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
package errortracking

import (
	"testing"

	"github.com/getsentry/sentry-go"
	"github.com/stretchr/testify/require"
)

func Test_applyCaptureOptions(t *testing.T) {
	tests := []struct {
		name           string
		opts           []CaptureOption
		wantConfig     captureConfig
		wantEventLevel sentry.Level
	}{
		{
			name:           "default",
			opts:           []CaptureOption{},
			wantConfig:     captureConfig{},
			wantEventLevel: sentry.LevelError,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			gotConfig, gotEvent := applyCaptureOptions(tt.opts)
			gotEventLevel := gotEvent.Level

			require.Equalf(t, gotConfig, tt.wantConfig, "applyCaptureOptions() = %v, want %v", gotConfig, tt.wantConfig)
			require.Equalf(t, gotEventLevel, tt.wantEventLevel, "applyCaptureOptions() Event.Level = %v, want %v", gotEventLevel, tt.wantEventLevel)
		})
	}
}