-
Notifications
You must be signed in to change notification settings - Fork 1
/
pipe_test.go
57 lines (52 loc) · 1.3 KB
/
pipe_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
50
51
52
53
54
55
56
57
package hop
import (
"testing"
"go.hop.io/sdk/types"
)
func TestClient_Pipe_Rooms_GetAll(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "GET",
wantPath: "/pipe/rooms",
wantClientOpts: []ClientOption{WithProjectID("test123")},
wantResultKey: "rooms",
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryPipeRooms{c: c},
"GetAll",
[]any{WithProjectID("test123")},
[]*types.Room{{Name: "hello"}})
}
func TestClient_Pipe_Rooms_Create(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "POST",
wantPath: "/pipe/rooms",
wantResultKey: "room",
wantIgnore404: false,
wantBody: types.RoomCreationOptions{Name: "test"},
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryPipeRooms{c: c},
"Create",
[]any{types.RoomCreationOptions{Name: "test"}},
&types.Room{Name: "hello"})
}
func TestClient_Pipe_Rooms_Delete(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "DELETE",
wantPath: "/pipe/rooms/test%20test",
wantClientOpts: []ClientOption{WithProjectID("test123")},
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryPipeRooms{c: c},
"Delete",
[]any{"test test", WithProjectID("test123")},
nil)
}