import { LoqateAddressLookupError } from "./LoqateAddressLookupError";
import type { LoqateErrorItem } from "./types";

describe("LoqateAddressLookupError", () => {
  it("should create an error with the correct name and message", () => {
    const errorResponse: LoqateErrorItem = {
      Description: "Test error",
      Error: "Test error code",
      Cause: "Test cause",
      Resolution: "Test resolution",
    };
    const error = new LoqateAddressLookupError(errorResponse);

    expect(error.name).toBe("LoqateAddressLookupError");
    expect(error.message).toBe("Test error");
    expect(error.response).toBe(errorResponse);
  });

  it("should be an instance of Error", () => {
    const errorResponse: LoqateErrorItem = {
      Description: "Test error",
      Error: "Test error code",
      Cause: "Test cause",
      Resolution: "Test resolution",
    };
    const error = new LoqateAddressLookupError(errorResponse);

    expect(error).toBeInstanceOf(Error);
    expect(error).toBeInstanceOf(LoqateAddressLookupError);
  });
});
