Assert label tests exist in db
Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
parent
659045e351
commit
2e55c48ece
|
@ -314,6 +314,14 @@ func TestLabel_Create(t *testing.T) {
|
|||
if err := l.Create(tt.args.a); (err != nil) != tt.wantErr {
|
||||
t.Errorf("Label.Create() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
if !tt.wantErr {
|
||||
db.AssertDBExists(t, "labels", map[string]interface{}{
|
||||
"id": l.ID,
|
||||
"title": l.Title,
|
||||
"description": l.Description,
|
||||
"hex_color": l.HexColor,
|
||||
}, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -396,6 +404,12 @@ func TestLabel_Update(t *testing.T) {
|
|||
if err := l.Update(); (err != nil) != tt.wantErr {
|
||||
t.Errorf("Label.Update() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
if !tt.wantErr && !tt.wantForbidden {
|
||||
db.AssertDBExists(t, "labels", map[string]interface{}{
|
||||
"id": tt.fields.ID,
|
||||
"title": tt.fields.Title,
|
||||
}, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -474,6 +488,11 @@ func TestLabel_Delete(t *testing.T) {
|
|||
if err := l.Delete(); (err != nil) != tt.wantErr {
|
||||
t.Errorf("Label.Delete() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
if !tt.wantErr && !tt.wantForbidden {
|
||||
db.AssertDBMissing(t, "labels", map[string]interface{}{
|
||||
"id": l.ID,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue