|
@@ -0,0 +1,21 @@
|
|
|
|
+package discordgo
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "testing"
|
|
|
|
+ "time"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+func TestSnowflakeTimestamp(t *testing.T) {
|
|
|
|
+ // #discordgo channel ID :)
|
|
|
|
+ id := "155361364909621248"
|
|
|
|
+ parsedTimestamp, err := SnowflakeTimestamp(id)
|
|
|
|
+
|
|
|
|
+ if err != nil {
|
|
|
|
+ t.Errorf("returned error incorrect: got %v, want nil", err)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ correctTimestamp := time.Date(2016, time.March, 4, 17, 10, 35, 869*1000000, time.UTC)
|
|
|
|
+ if !parsedTimestamp.Equal(correctTimestamp) {
|
|
|
|
+ t.Errorf("parsed time incorrect: got %v, want %v", parsedTimestamp, correctTimestamp)
|
|
|
|
+ }
|
|
|
|
+}
|