github.com/wormhole-foundation/wormhole-explorer/common@v0.0.0-20240604151348-09585b5b97c5/client/cache/notional/cache_test.go (about)

     1  package notional
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestNotionalCache_renderKey(t *testing.T) {
    10  
    11  	nc := &NotionalCache{
    12  		client: nil,
    13  		prefix: "staging-mainnet",
    14  	}
    15  
    16  	key := nc.renderKey("BTC/USDT")
    17  	assert.Equal(t, "staging-mainnet:BTC/USDT", key)
    18  
    19  }
    20  
    21  func TestNotionalCache_renderRegexp(t *testing.T) {
    22  
    23  	nc := &NotionalCache{
    24  		client: nil,
    25  		prefix: "staging-mainnet",
    26  	}
    27  
    28  	key := nc.renderRegExp()
    29  	assert.Equal(t, "*staging-mainnet:WORMSCAN:NOTIONAL:TOKEN:*", key)
    30  
    31  	nc = &NotionalCache{
    32  		client: nil,
    33  		prefix: "",
    34  	}
    35  	key = nc.renderRegExp()
    36  	assert.Equal(t, "*WORMSCAN:NOTIONAL:TOKEN:*", key)
    37  
    38  }