2021-02-22 00:52:18 +03:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-04-11 22:20:37 +03:00
|
|
|
"go.unistack.org/micro/v4/errors"
|
2021-02-22 00:52:18 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestError(t *testing.T) {
|
|
|
|
e := NewError("svc1")
|
|
|
|
err := e.BadRequest("%s", "test")
|
|
|
|
merr, ok := err.(*errors.Error)
|
|
|
|
if !ok {
|
|
|
|
t.Fatal("error not *errors.Error")
|
|
|
|
}
|
2021-09-30 21:00:02 +03:00
|
|
|
if merr.ID != "svc1" {
|
2021-02-22 00:52:18 +03:00
|
|
|
t.Fatal("id != svc1")
|
|
|
|
}
|
|
|
|
}
|