Remove monitor server and instead use callback

This commit is contained in:
Bel LaPointe
2018-10-09 08:16:18 -06:00
parent b5ff055505
commit 236ca1d603
4 changed files with 32 additions and 100 deletions

View File

@@ -1,6 +1,7 @@
package monitor
import (
"encoding/json"
"testing"
"time"
)
@@ -59,3 +60,15 @@ func Test_ItemCompare(t *testing.T) {
}
}
}
func Test_ItemJSON(t *testing.T) {
item := NewItem("any", time.Minute)
var itemB Item
if b, err := json.Marshal(item); err != nil {
t.Fatalf("cannot marshal item: %v", err)
} else if err := json.Unmarshal(b, &itemB); err != nil {
t.Fatalf("cannot unmarshal item: %v", err)
} else if item.next = itemB.next; itemB != *item {
t.Fatalf("unmarshaled item does not match original: %v, expected %v", itemB, *item)
}
}