2023-06-28 11:04:36 -07:00
|
|
|
package notifier
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/test-go/testify/assert"
|
|
|
|
"github.com/wormhole-foundation/wormhole-explorer/fly/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewLastSequenceNotifier(t *testing.T) {
|
|
|
|
|
|
|
|
l := NewLastSequenceNotifier(nil, "mainnet-staging")
|
|
|
|
|
2023-07-03 11:58:34 -07:00
|
|
|
assert.Equal(t, "mainnet-staging:wormscan:vaa-max-sequence", l.prefix)
|
2023-06-28 11:04:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewLastSequenceNotifierBackwardsCompat(t *testing.T) {
|
|
|
|
|
|
|
|
prefix := config.GetPrefix()
|
|
|
|
|
|
|
|
l := NewLastSequenceNotifier(nil, prefix)
|
|
|
|
|
|
|
|
assert.Equal(t, "wormscan:vaa-max-sequence", l.prefix)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNewLastSequenceNotifierWithPrefix(t *testing.T) {
|
|
|
|
|
|
|
|
os.Setenv("P2P_NETWORK", "mainnet")
|
2023-06-29 11:07:07 -07:00
|
|
|
os.Setenv("ENVIRONMENT", "staging")
|
2023-06-28 11:04:36 -07:00
|
|
|
|
|
|
|
prefix := config.GetPrefix()
|
|
|
|
|
|
|
|
l := NewLastSequenceNotifier(nil, prefix)
|
|
|
|
|
2023-07-03 11:58:34 -07:00
|
|
|
assert.Equal(t, "mainnet-staging:wormscan:vaa-max-sequence", l.prefix)
|
2023-06-28 11:04:36 -07:00
|
|
|
}
|