Skip to content

Commit

Permalink
Enable a long time ago disabled test that works ?
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Aug 22, 2019
1 parent fd14d47 commit c002c1e
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions api/v1/group_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,33 @@ func TestGetGroups(t *testing.T) {
}
})

// t.Run("groups", func(t *testing.T) {
// var groups []Group
// assert.NoError(t, jsonapi.Unmarshal(body, &groups))
// if assert.Len(t, groups, 3) {
// for _, g := range groups {
// switch g.ID {
// case g0.ID:
// assert.Equal(t, "", g.Name)
// assert.Nil(t, g.Parent)
// assert.Equal(t, "", g.ParentID)
// assert.Len(t, g.GroupIDs, 1)
// assert.EqualValues(t, []string{g1.ID}, g.GroupIDs)
// case g1.ID:
// assert.Equal(t, "group 1", g.Name)
// assert.Nil(t, g.Parent)
// assert.Equal(t, g0.ID, g.ParentID)
// assert.EqualValues(t, []string{g2.ID}, g.GroupIDs)
// case g2.ID:
// assert.Equal(t, "group 2", g.Name)
// assert.Nil(t, g.Parent)
// assert.Equal(t, g1.ID, g.ParentID)
// assert.EqualValues(t, []string{}, g.GroupIDs)
// default:
// assert.Fail(t, "Unknown ID: "+g.ID)
// }
// }
// }
// })
t.Run("groups", func(t *testing.T) {
var groups []Group
require.NoError(t, jsonapi.Unmarshal(body, &groups))
require.Len(t, groups, 3)
for _, g := range groups {
switch g.ID {
case g0.ID:
assert.Equal(t, "", g.Name)
assert.Nil(t, g.Parent)
assert.Equal(t, "", g.ParentID)
assert.Len(t, g.GroupIDs, 1)
assert.EqualValues(t, []string{g1.ID}, g.GroupIDs)
case g1.ID:
assert.Equal(t, "group 1", g.Name)
assert.Nil(t, g.Parent)
assert.Equal(t, g0.ID, g.ParentID)
assert.EqualValues(t, []string{g2.ID}, g.GroupIDs)
case g2.ID:
assert.Equal(t, "group 2", g.Name)
assert.Nil(t, g.Parent)
assert.Equal(t, g1.ID, g.ParentID)
assert.EqualValues(t, []string{}, g.GroupIDs)
default:
assert.Fail(t, "Unknown ID: "+g.ID)
}
}
})
})
for _, gp := range []*lib.Group{g0, g1, g2} {
t.Run(gp.Name, func(t *testing.T) {
Expand Down

0 comments on commit c002c1e

Please sign in to comment.