github.com/blend/go-sdk@v1.20220411.3/copyright/option_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package copyright
     9  
    10  import (
    11  	"testing"
    12  
    13  	"github.com/blend/go-sdk/assert"
    14  )
    15  
    16  func Test_Options(t *testing.T) {
    17  	t.Parallel()
    18  	its := assert.New(t)
    19  
    20  	c := new(Copyright)
    21  
    22  	its.Nil(c.Config.Verbose)
    23  	OptVerbose(true)(c)
    24  	its.True(*c.Config.Verbose)
    25  
    26  	its.Nil(c.Config.Debug)
    27  	OptDebug(true)(c)
    28  	its.True(*c.Config.Debug)
    29  
    30  	its.Nil(c.Config.ExitFirst)
    31  	OptExitFirst(true)(c)
    32  	its.True(*c.Config.ExitFirst)
    33  
    34  	its.Empty(c.Config.IncludeFiles)
    35  	OptIncludeFiles("opt-include-0", "opt-include-1")(c)
    36  	its.Equal([]string{"opt-include-0", "opt-include-1"}, c.Config.IncludeFiles)
    37  
    38  	its.Empty(c.Config.Excludes)
    39  	OptExcludes("opt-exclude-0", "opt-exclude-1")(c)
    40  	its.Equal([]string{"opt-exclude-0", "opt-exclude-1"}, c.Config.Excludes)
    41  
    42  	its.Empty(c.Config.NoticeBodyTemplate)
    43  	OptNoticeBodyTemplate("opt-notice-body-template")(c)
    44  	its.Equal("opt-notice-body-template", c.Config.NoticeBodyTemplate)
    45  
    46  	its.Zero(c.Config.Year)
    47  	OptYear(2021)(c)
    48  	its.Equal(2021, c.Config.Year)
    49  
    50  	its.Empty(c.Config.Company)
    51  	OptCompany("opt-company")(c)
    52  	its.Equal("opt-company", c.Config.Company)
    53  
    54  	its.Empty(c.Config.License)
    55  	OptLicense("opt-license")(c)
    56  	its.Equal("opt-license", c.Config.License)
    57  
    58  	its.Empty(c.Config.Restrictions)
    59  	OptRestrictions("opt-restrictions")(c)
    60  	its.Equal("opt-restrictions", c.Config.Restrictions)
    61  
    62  	OptConfig(Config{})(c)
    63  	its.Empty(c.Config.Restrictions)
    64  }