mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-13 05:11:20 +01:00
found NPE
This commit is contained in:
parent
285e72e4e6
commit
e9fed7a488
1 changed files with 8 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
package forgefed
|
package forgefed
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -37,7 +38,7 @@ func Test_NewForgeLike(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_StarMarshalJSON(t *testing.T) {
|
func Test_LikeMarshalJSON(t *testing.T) {
|
||||||
type testPair struct {
|
type testPair struct {
|
||||||
item ForgeLike
|
item ForgeLike
|
||||||
want []byte
|
want []byte
|
||||||
|
@ -75,7 +76,7 @@ func Test_StarMarshalJSON(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_StarUnmarshalJSON(t *testing.T) {
|
func Test_LikeUnmarshalJSON(t *testing.T) {
|
||||||
type testPair struct {
|
type testPair struct {
|
||||||
item []byte
|
item []byte
|
||||||
want *ForgeLike
|
want *ForgeLike
|
||||||
|
@ -93,6 +94,10 @@ func Test_StarUnmarshalJSON(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"wrong": {
|
||||||
|
item: []byte(`{"type":"Wrong","actor":"https://repo.prod.meissa.de/api/activitypub/user-id/1","object":"https://codeberg.org/api/activitypub/repository-id/1"}`),
|
||||||
|
wantErr: fmt.Errorf("an other error"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tt := range tests {
|
for name, tt := range tests {
|
||||||
|
@ -104,7 +109,7 @@ func Test_StarUnmarshalJSON(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("UnmarshalJSON() got = %q, want %q", got, tt.want)
|
t.Errorf("UnmarshalJSON() got = %q, want %q, err %q", got, tt.want, err.Error())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue