-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper_test.go
49 lines (46 loc) · 1.17 KB
/
helper_test.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package controllers
import (
"testing"
v1 "github.com/LilithGames/spiracle/api/v1"
"github.com/stretchr/testify/assert"
)
func TestDiffRoomStatus(t *testing.T) {
a := v1.RoomIngressStatus{
Rooms: []v1.RoomIngressRoomStatus{
v1.RoomIngressRoomStatus{
Id: "r1",
Players: []v1.RoomIngressPlayerStatus{
v1.RoomIngressPlayerStatus{Id: "p1", Token: 1},
v1.RoomIngressPlayerStatus{Id: "p2", Token: 2},
},
},
v1.RoomIngressRoomStatus{
Id: "r2",
Players: []v1.RoomIngressPlayerStatus{
v1.RoomIngressPlayerStatus{Id: "p3", Token: 3},
v1.RoomIngressPlayerStatus{Id: "p4", Token: 4},
},
},
},
}
b := v1.RoomIngressStatus{
Rooms: []v1.RoomIngressRoomStatus{
v1.RoomIngressRoomStatus{
Id: "r1",
Players: []v1.RoomIngressPlayerStatus{
v1.RoomIngressPlayerStatus{Id: "p1", Token: 7},
v1.RoomIngressPlayerStatus{Id: "p2", Token: 2},
},
},
v1.RoomIngressRoomStatus{
Id: "r3",
Players: []v1.RoomIngressPlayerStatus{
v1.RoomIngressPlayerStatus{Id: "p5", Token: 5},
v1.RoomIngressPlayerStatus{Id: "p6", Token: 6},
},
},
},
}
r := DiffRoomStatus(&a, &b)
assert.Equal(t, 5, len(r))
}