import { ResponseError } from "./error";
import { DageResponse } from "./types";

test("ResponseError", () => {
  const response = {
    errorMessage: "请求失败",
    data: "test",
    errorCode: -1,
  } as DageResponse;
  const error = new ResponseError(response);
  expect(error.code).toBe(-1);
  expect(error.message).toBe("请求失败");
  expect(error.response).toBe(response);
  expect(error.stack).toBeTruthy();
  expect(error instanceof Error).toBe(true);
});
