@@ -2,7 +2,7 @@ package posthog
2
2
3
3
import "testing"
4
4
5
- func TestGroupIdentifyMissingDistinctId (t * testing.T ) {
5
+ func TestGroupIdentifyMissingType (t * testing.T ) {
6
6
groupIdentify := GroupIdentify {}
7
7
8
8
if err := groupIdentify .Validate (); err == nil {
@@ -13,16 +13,34 @@ func TestGroupIdentifyMissingDistinctId(t *testing.T) {
13
13
14
14
} else if e != (FieldError {
15
15
Type : "posthog.GroupIdentify" ,
16
- Name : "DistinctId" ,
16
+ Name : "Type" ,
17
+ Value : "" ,
18
+ }) {
19
+ t .Error ("invalid error value returned when validating group identify:" , err )
20
+ }
21
+ }
22
+ func TestGroupIdentifyMissingKey (t * testing.T ) {
23
+ groupIdentify := GroupIdentify {}
24
+
25
+ if err := groupIdentify .Validate (); err == nil {
26
+ t .Error ("validating an invalid group identify object succeeded:" , groupIdentify )
27
+
28
+ } else if e , ok := err .(FieldError ); ! ok {
29
+ t .Error ("invalid error type returned when validating group identify:" , err )
30
+
31
+ } else if e != (FieldError {
32
+ Type : "posthog.GroupIdentify" ,
33
+ Name : "Key" ,
17
34
Value : "" ,
18
35
}) {
19
36
t .Error ("invalid error value returned when validating group identify:" , err )
20
37
}
21
38
}
22
39
23
- func TestGroupIdentifyValidWithDistinctId (t * testing.T ) {
24
- groupIdentify := Identify {
25
- DistinctId : "organization_id:5" ,
40
+ func TestGroupIdentifyValidWithTypeAndKey (t * testing.T ) {
41
+ groupIdentify := GroupIdentify {
42
+ Type : "organization" ,
43
+ Key : "id:5" ,
26
44
}
27
45
28
46
if err := groupIdentify .Validate (); err != nil {
0 commit comments