From c09e69ae59935edf6d85799e858c26de86b04cb3 Mon Sep 17 00:00:00 2001 From: Bruce Marriner Date: Fri, 12 Apr 2019 17:30:32 -0500 Subject: [PATCH] Added test for NewNode --- snowflake_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/snowflake_test.go b/snowflake_test.go index 83e19ca..89fb775 100644 --- a/snowflake_test.go +++ b/snowflake_test.go @@ -9,6 +9,20 @@ import ( //****************************************************************************** // General Test funcs +func TestNewNode(t *testing.T) { + + _, err := NewNode(0) + if err != nil { + t.Fatalf("error creating NewNode, %s", err) + } + + _, err = NewNode(5000) + if err == nil { + t.Fatalf("no error creating NewNode, %s", err) + } + +} + // lazy check if Generate will create duplicate IDs // would be good to later enhance this with more smarts func TestGenerateDuplicateID(t *testing.T) {