...

Source file src/github.com/launchdarkly/go-sdk-common/v3/ldreason/detail_test.go

Documentation: github.com/launchdarkly/go-sdk-common/v3/ldreason

     1  package ldreason
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/launchdarkly/go-sdk-common/v3/ldvalue"
     9  )
    10  
    11  func TestDetailConstructor(t *testing.T) {
    12  	detail := NewEvaluationDetail(ldvalue.Bool(true), 1, NewEvalReasonFallthrough())
    13  	assert.Equal(t, ldvalue.Bool(true), detail.Value)
    14  	assert.Equal(t, ldvalue.NewOptionalInt(1), detail.VariationIndex)
    15  	assert.Equal(t, NewEvalReasonFallthrough(), detail.Reason)
    16  	assert.False(t, detail.IsDefaultValue())
    17  }
    18  
    19  func TestDetailErrorConstructor(t *testing.T) {
    20  	detail := NewEvaluationDetailForError(EvalErrorFlagNotFound, ldvalue.Bool(false))
    21  	assert.Equal(t, ldvalue.Bool(false), detail.Value)
    22  	assert.Equal(t, ldvalue.OptionalInt{}, detail.VariationIndex)
    23  	assert.Equal(t, NewEvalReasonError(EvalErrorFlagNotFound), detail.Reason)
    24  	assert.True(t, detail.IsDefaultValue())
    25  }
    26  

View as plain text