text: import AccountCreateTransaction from "../src/account/AccountCreateTransaction.js";
  import AccountDeleteTransaction from "../src/account/AccountDeleteTransaction.js";
  import AccountInfoQuery from "../src/account/AccountInfoQuery.js";
  import Hbar from "../src/Hbar.js";
  import Status from "../src/Status.js";
  import TransactionId from "../../src/transaction/TransactionId.js";
  import IntegrationTestEnv from "./client/NodeIntegrationTestEnv.js";
  import { PrivateKey } from "../src/index.js";
  
  describe("AccountDelete", function () {
      it("should be executable", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          const operatorId = env.operatorId;
          const key = PrivateKey.generate();
  
          const response = await new AccountCreateTransaction()
              .setKey(key.publicKey)
              .setInitialBalance(new Hbar(2))
              .execute(env.client);
  
          const receipt = await response.getReceipt(env.client);
  
          expect(receipt.accountId).to.not.be.null;
          const account = receipt.accountId;
  
          const info = await new AccountInfoQuery()
              .setAccountId(account)
              .execute(env.client);
  
          expect(info.accountId.toString()).to.be.equal(account.toString());
          expect(info.isDeleted).to.be.false;
          expect(info.key.toString()).to.be.equal(key.publicKey.toString());
          expect(info.balance.toTinybars().toInt()).to.be.equal(
              new Hbar(2).toTinybars().toInt()
          );
          expect(info.autoRenewPeriod.seconds.toNumber()).to.be.equal(7776000);
          expect(info.proxyAccountId).to.be.null;
          expect(info.proxyReceived.toTinybars().toInt()).to.be.equal(0);
  
          await (
              await (
                  await new AccountDeleteTransaction()
                      .setAccountId(account)
                      .setTransferAccountId(operatorId)
                      .setTransactionId(TransactionId.generate(account))
                      .freezeWith(env.client)
                      .sign(key)
              ).execute(env.client)
          ).getReceipt(env.client);
  
          await env.close();
      });
  
      it("should error with invalid signature", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          const operatorId = env.operatorId;
          const key = PrivateKey.generate();
  
          const response = await new AccountCreateTransaction()
              .setKey(key.publicKey)
              .setInitialBalance(new Hbar(2))
              .execute(env.client);
  
          const receipt = await response.getReceipt(env.client);
  
          expect(receipt.accountId).to.not.be.null;
          const account = receipt.accountId;
  
          let err = false;
  
          try {
              await (
                  await new AccountDeleteTransaction()
                      .setAccountId(account)
                      .setTransferAccountId(operatorId)
                      .setTransactionId(TransactionId.generate(account))
                      .execute(env.client)
              ).getReceipt(env.client);
          } catch (error) {
              err = error.toString().includes(Status.InvalidSignature.toString());
          }
  
          if (!err) {
              throw new Error("account deletion did not error");
          }
  
          await env.close();
      });
  
      it("should error with no account ID set", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          let err = false;
  
          try {
              await (
                  await new AccountDeleteTransaction()
                      .setTransferAccountId(env.operatorId)
                      .freezeWith(env.client)
                      .execute(env.client)
              ).getReceipt(env.client);
          } catch (error) {
              err = error
                  .toString()
                  .includes(Status.AccountIdDoesNotExist.toString());
          }
  
          if (!err) {
              throw new Error("account deletion did not error");
          }
  
          await env.close();
      });
  });
  