mirror of
https://github.com/godruoyi/go-snowflake.git
synced 2026-01-07 12:35:18 +00:00
❄ Change readme and fixed test case
This commit is contained in:
@@ -194,9 +194,16 @@ func TestParseID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSID_GenerateTime(t *testing.T) {
|
||||
sid := snowflake.ParseID(snowflake.ID())
|
||||
snowflake.SetSequenceResolver(snowflake.AtomicResolver)
|
||||
a, e := snowflake.NextID()
|
||||
if e != nil {
|
||||
t.Error(e)
|
||||
return
|
||||
}
|
||||
|
||||
sid := snowflake.ParseID(a)
|
||||
|
||||
if sid.GenerateTime().UTC().Second() != time.Now().UTC().Second() {
|
||||
t.Error("The id generate time should be equal")
|
||||
t.Error("The id generate time should be equal current time")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user