github.com/pkumar631/talisman@v0.3.2/detector/hex_detector_test.go (about)

     1  package detector
     2  
     3  import (
     4  	"github.com/stretchr/testify/assert"
     5  	"testing"
     6  )
     7  
     8  func TestHexDetectorShouldNotDetectSafeText(t *testing.T) {
     9  	s := "pretty safe"
    10  	hd := HexDetector{}
    11  	hd.initHexMap()
    12  
    13  	res := hd.checkHexEncoding(s)
    14  	assert.Equal(t, "", res)
    15  }
    16  
    17  func TestHexDetectorShouldDetectBase64Text(t *testing.T) {
    18  	s := "6A6176617375636B73676F726F636B7368616861"
    19  	hd := HexDetector{}
    20  	hd.initHexMap()
    21  
    22  	res := hd.checkHexEncoding(s)
    23  	assert.Equal(t, s, res)
    24  }