update assert param(expect, actual) position (#1421)
- update assert param(expect, actual) position
This commit is contained in:
parent
1c4cbfae59
commit
d17a12591f
@ -19,17 +19,17 @@ func TestError(t *testing.T) {
|
||||
Type: ErrorTypePrivate,
|
||||
}
|
||||
assert.Equal(t, err.Error(), baseError.Error())
|
||||
assert.Equal(t, err.JSON(), H{"error": baseError.Error()})
|
||||
assert.Equal(t, H{"error": baseError.Error()}, err.JSON())
|
||||
|
||||
assert.Equal(t, err.SetType(ErrorTypePublic), err)
|
||||
assert.Equal(t, err.Type, ErrorTypePublic)
|
||||
assert.Equal(t, ErrorTypePublic, err.Type)
|
||||
|
||||
assert.Equal(t, err.SetMeta("some data"), err)
|
||||
assert.Equal(t, err.Meta, "some data")
|
||||
assert.Equal(t, err.JSON(), H{
|
||||
assert.Equal(t, "some data", err.Meta)
|
||||
assert.Equal(t, H{
|
||||
"error": baseError.Error(),
|
||||
"meta": "some data",
|
||||
})
|
||||
}, err.JSON())
|
||||
|
||||
jsonBytes, _ := json.Marshal(err)
|
||||
assert.Equal(t, "{\"error\":\"test error\",\"meta\":\"some data\"}", string(jsonBytes))
|
||||
@ -38,22 +38,22 @@ func TestError(t *testing.T) {
|
||||
"status": "200",
|
||||
"data": "some data",
|
||||
})
|
||||
assert.Equal(t, err.JSON(), H{
|
||||
assert.Equal(t, H{
|
||||
"error": baseError.Error(),
|
||||
"status": "200",
|
||||
"data": "some data",
|
||||
})
|
||||
}, err.JSON())
|
||||
|
||||
err.SetMeta(H{
|
||||
"error": "custom error",
|
||||
"status": "200",
|
||||
"data": "some data",
|
||||
})
|
||||
assert.Equal(t, err.JSON(), H{
|
||||
assert.Equal(t, H{
|
||||
"error": "custom error",
|
||||
"status": "200",
|
||||
"data": "some data",
|
||||
})
|
||||
}, err.JSON())
|
||||
|
||||
type customError struct {
|
||||
status string
|
||||
|
@ -51,7 +51,7 @@ func TestResponseWriterWriteHeader(t *testing.T) {
|
||||
w.WriteHeader(300)
|
||||
assert.False(t, w.Written())
|
||||
assert.Equal(t, 300, w.Status())
|
||||
assert.NotEqual(t, testWritter.Code, 300)
|
||||
assert.NotEqual(t, 300, testWritter.Code)
|
||||
|
||||
w.WriteHeader(-1)
|
||||
assert.Equal(t, 300, w.Status())
|
||||
|
Loading…
Reference in New Issue
Block a user