github.com/meowstercatel/discordgo@v0.0.0-20250615204139-29b43d676735/util_test.go (about)

     1  package discordgo
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  )
     7  
     8  func TestSnowflakeTimestamp(t *testing.T) {
     9  	// #discordgo channel ID :)
    10  	id := "155361364909621248"
    11  	parsedTimestamp, err := SnowflakeTimestamp(id)
    12  
    13  	if err != nil {
    14  		t.Errorf("returned error incorrect: got %v, want nil", err)
    15  	}
    16  
    17  	correctTimestamp := time.Date(2016, time.March, 4, 17, 10, 35, 869*1000000, time.UTC)
    18  	if !parsedTimestamp.Equal(correctTimestamp) {
    19  		t.Errorf("parsed time incorrect: got %v, want %v", parsedTimestamp, correctTimestamp)
    20  	}
    21  }