go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/copyright/constants_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package copyright
     9  
    10  import (
    11  	"testing"
    12  
    13  	"go.charczuk.com/sdk/assert"
    14  )
    15  
    16  func Test_DefaultNoticeTemplate(t *testing.T) {
    17  	actual := mustRenderTemplate(DefaultNoticeTemplate, struct {
    18  		Year            int
    19  		CopyrightHolder string
    20  		Restrictions    string
    21  	}{
    22  		Year:            2023,
    23  		CopyrightHolder: "Bailey Dog",
    24  		Restrictions:    "Test Restrictions",
    25  	})
    26  	expected := `Copyright (c) 2023 - Present. Bailey Dog. All rights reserved.
    27  Test Restrictions`
    28  
    29  	assert.ItsEqual(t, expected, actual)
    30  }
    31  
    32  func Test_DefaultNoticeTemplate_noRestrictions(t *testing.T) {
    33  	actual := mustRenderTemplate(DefaultNoticeTemplate, struct {
    34  		Year            int
    35  		CopyrightHolder string
    36  		Restrictions    string
    37  	}{
    38  		Year:            2023,
    39  		CopyrightHolder: "Bailey Dog",
    40  	})
    41  	expected := `Copyright (c) 2023 - Present. Bailey Dog. All rights reserved.`
    42  
    43  	assert.ItsEqual(t, expected, actual)
    44  }
    45  
    46  func Test_RestrictionsTemplateInternal(t *testing.T) {
    47  	actual := mustRenderTemplate(DefaultRestrictionsTemplateInternal, struct {
    48  		CopyrightHolder string
    49  	}{
    50  		CopyrightHolder: "Bailey Dog",
    51  	})
    52  	expected := `Bailey Dog Confidential - Restricted`
    53  
    54  	assert.ItsEqual(t, expected, actual)
    55  }
    56  
    57  func Test_RestrictionsTemplateInternal_noCopyrightHolder(t *testing.T) {
    58  	actual := mustRenderTemplate(DefaultRestrictionsTemplateInternal, struct {
    59  		CopyrightHolder string
    60  	}{})
    61  	expected := `Confidential - Restricted`
    62  
    63  	assert.ItsEqual(t, expected, actual)
    64  }