import {
  afterEach,
  describe,
  globalExpect,
  init_dist,
  it
} from "../../chunk-GCCHFONX.mjs";
import {
  Blindpay,
  init_client
} from "../../chunk-ES7RXEM7.mjs";
import "../../chunk-GEDDLCJY.mjs";
import "../../chunk-LK3JPQ6I.mjs";
import "../../chunk-CNNEROQ7.mjs";
import "../../chunk-GNDAATIJ.mjs";
import "../../chunk-VKN2AMCW.mjs";
import "../../chunk-LUDGZPXY.mjs";
import "../../chunk-3CZJEDS5.mjs";
import "../../chunk-UCAW3RTZ.mjs";
import "../../chunk-M6IYYMRW.mjs";
import "../../chunk-HKFAJXJG.mjs";
import "../../chunk-QVOSGLUO.mjs";
import "../../chunk-2DAKB5XK.mjs";
import "../../chunk-QHMIK7U3.mjs";
import "../../chunk-LLWEHHKB.mjs";
import {
  __async,
  __commonJS
} from "../../chunk-OBKEW4AQ.mjs";

// src/resources/instances/instances.test.ts
var require_instances_test = __commonJS({
  "src/resources/instances/instances.test.ts"(exports) {
    init_dist();
    init_client();
    describe("Instances", () => {
      afterEach(() => fetchMock.resetMocks());
      const blindpay = new Blindpay("test-key");
      describe("Get instance members", () => {
        it("should get instance members", () => __async(null, null, function* () {
          const mockedMembers = [
            {
              id: "us_000000000000",
              email: "email@example.com",
              first_name: "Harry",
              middle_name: "James",
              last_name: "Potter",
              image_url: "https://example.com/image.png",
              created_at: "2021-01-01T00:00:00Z",
              role: "admin"
            }
          ];
          fetchMock.mockResponseOnce(JSON.stringify(mockedMembers), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.instances.getMembers({
            instanceId: "in_000000000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual(mockedMembers);
        }));
      });
      describe("Update instance", () => {
        it("should update an instance", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({ data: null }), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.instances.update({
            instanceId: "in_000000000000",
            name: "New Instance Name"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual({ data: null });
        }));
      });
      describe("Delete instance", () => {
        it("should delete an instance", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({ data: null }), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.instances.delete({
            instanceId: "in_000000000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual({ data: null });
        }));
      });
      describe("Delete instance member", () => {
        it("should delete an instance member", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({ data: null }), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.instances.deleteMember({
            instanceId: "in_000000000000",
            id: "us_000000000000"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual({ data: null });
        }));
      });
      describe("Update instance member role", () => {
        it("should update instance member role", () => __async(null, null, function* () {
          fetchMock.mockResponseOnce(JSON.stringify({ data: null }), {
            headers: { "Content-Type": "application/json" }
          });
          const { data, error } = yield blindpay.instances.updateMemberRole({
            instanceId: "in_000000000000",
            id: "us_000000000000",
            role: "checker"
          });
          globalExpect(error).toBeNull();
          globalExpect(data).toEqual({ data: null });
        }));
      });
    });
  }
});
export default require_instances_test();
