gitlab.com/gitlab-org/labkit@v1.21.0/errortracking/capture_options_test.go (about) 1 package errortracking 2 3 import ( 4 "testing" 5 6 "github.com/getsentry/sentry-go" 7 "github.com/stretchr/testify/require" 8 ) 9 10 func Test_applyCaptureOptions(t *testing.T) { 11 tests := []struct { 12 name string 13 opts []CaptureOption 14 wantConfig captureConfig 15 wantEventLevel sentry.Level 16 }{ 17 { 18 name: "default", 19 opts: []CaptureOption{}, 20 wantConfig: captureConfig{}, 21 wantEventLevel: sentry.LevelError, 22 }, 23 } 24 for _, tt := range tests { 25 t.Run(tt.name, func(t *testing.T) { 26 gotConfig, gotEvent := applyCaptureOptions(tt.opts) 27 gotEventLevel := gotEvent.Level 28 29 require.Equalf(t, gotConfig, tt.wantConfig, "applyCaptureOptions() = %v, want %v", gotConfig, tt.wantConfig) 30 require.Equalf(t, gotEventLevel, tt.wantEventLevel, "applyCaptureOptions() Event.Level = %v, want %v", gotEventLevel, tt.wantEventLevel) 31 }) 32 } 33 }