github.com/blend/go-sdk@v1.20240719.1/copyright/constants_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - 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  	"fmt"
    12  	"testing"
    13  
    14  	"github.com/blend/go-sdk/assert"
    15  )
    16  
    17  func Test_KnownExtensions_templates(t *testing.T) {
    18  	its := assert.New(t)
    19  
    20  	for _, ext := range KnownExtensions {
    21  		_, ok := DefaultExtensionNoticeTemplates[ext]
    22  		its.True(ok, fmt.Sprintf("%s should have a known template", ext))
    23  	}
    24  }
    25  
    26  func Test_KnownExtensions_includeFiles(t *testing.T) {
    27  	its := assert.New(t)
    28  
    29  	anyIncludeFiles := func(value string) bool {
    30  		for _, include := range DefaultIncludeFiles {
    31  			if value == include {
    32  				return true
    33  			}
    34  		}
    35  		return false
    36  	}
    37  	for _, ext := range KnownExtensions {
    38  		ok := anyIncludeFiles("*" + ext)
    39  		its.True(ok, fmt.Sprintf("%s should be in the included files list", ext))
    40  	}
    41  }
    42  
    43  func Test_tsImportsTagMatch(t *testing.T) {
    44  	its := assert.New(t)
    45  
    46  	its.Matches(tsReferenceTagsExpr, goldenTsReferenceTags)
    47  	its.Matches(tsReferenceTagsExpr, tsReferenceTags)
    48  	its.NotMatches(tsReferenceTagsExpr, goldenTs)
    49  }