-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconsensus_test.go
More file actions
31 lines (24 loc) · 821 Bytes
/
Copy pathconsensus_test.go
File metadata and controls
31 lines (24 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package nara
import (
"testing"
"github.com/eljojo/nara/types"
)
// Legacy consensus tests have been removed - the neighbourhood-based consensus
// functions have been replaced by projection-based consensus using the event store.
// See consensus_events_test.go for the projection-based consensus tests.
func TestObservations_OnlineTransitions(t *testing.T) {
t.Parallel()
ln := testLocalNara(t, "me")
network := ln.Network
name := types.NaraName("target")
network.importNara(NewNara(name))
obs := network.local.getObservation(name)
if obs.Online != "" {
t.Errorf("expected initial state to be empty, got %s", obs.Online)
}
network.recordObservationOnlineNara(name, 0)
obs = network.local.getObservation(name)
if obs.Online != "ONLINE" {
t.Errorf("expected state ONLINE, got %s", obs.Online)
}
}