Skip to content

Commit 4489191

Browse files
authored
Add missing unit test (google#1765)
1 parent 80aa64e commit 4489191

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

github/git_trees_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ import (
1515
"testing"
1616
)
1717

18+
func TestMarshalJSON_withNilContentAndSHA(t *testing.T) {
19+
te := &TreeEntry{
20+
Path: String("path"),
21+
Mode: String("mode"),
22+
Type: String("type"),
23+
Size: Int(1),
24+
URL: String("url"),
25+
}
26+
27+
got, err := te.MarshalJSON()
28+
if err != nil {
29+
t.Errorf("MarshalJSON: %v", err)
30+
}
31+
32+
want := `{"sha":null,"path":"path","mode":"mode","type":"type"}`
33+
if string(got) != want {
34+
t.Errorf("MarshalJSON = %s, want %v", got, want)
35+
}
36+
}
37+
1838
func TestGitService_GetTree(t *testing.T) {
1939
client, mux, _, teardown := setup()
2040
defer teardown()

0 commit comments

Comments
 (0)