Skip to content

Commit

Permalink
test: add regression tests on Action JSON methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilien-R committed Dec 19, 2024
1 parent cadb6f7 commit b8a257e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scm/const_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,24 @@ func TestStateJSON(t *testing.T) {
})
}
}

func TestActionJSON(t *testing.T) {
for i := ActionCreate; i < ActionCompleted; i++ {
in := i
t.Run(in.String(), func(t *testing.T) {
b, err := json.Marshal(in)
if err != nil {
t.Fatal(err)
}

var out Action
if err := json.Unmarshal(b, &out); err != nil {
t.Fatal(err)
}

if in != out {
t.Errorf("%s != %s", in, out)
}
})
}
}

0 comments on commit b8a257e

Please sign in to comment.