text: import {
      AccountCreateTransaction,
      AccountInfoQuery,
      Hbar,
      PrivateKey,
      Status,
      TokenAssociateTransaction,
      TokenCreateTransaction,
      TokenFreezeTransaction,
  } from "../../src/exports.js";
  import IntegrationTestEnv from "./client/NodeIntegrationTestEnv.js";
  
  describe("TokenFreeze", function () {
      it("should be executable", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          const operatorId = env.operatorId;
          const operatorKey = env.operatorKey.publicKey;
          const key = PrivateKey.generateED25519();
  
          const response = await new AccountCreateTransaction()
              .setKey(key)
              .setInitialBalance(new Hbar(2))
              .execute(env.client);
  
          const account = (await response.getReceipt(env.client)).accountId;
  
          const token = (
              await (
                  await new TokenCreateTransaction()
                      .setTokenName("ffff")
                      .setTokenSymbol("F")
                      .setDecimals(3)
                      .setInitialSupply(1000000)
                      .setTreasuryAccountId(operatorId)
                      .setAdminKey(operatorKey)
                      .setKycKey(operatorKey)
                      .setFreezeKey(operatorKey)
                      .setWipeKey(operatorKey)
                      .setSupplyKey(operatorKey)
                      .setFreezeDefault(false)
                      .execute(env.client)
              ).getReceipt(env.client)
          ).tokenId;
  
          await (
              await (
                  await new TokenAssociateTransaction()
                      .setTokenIds([token])
                      .setAccountId(account)
                      .freezeWith(env.client)
                      .sign(key)
              ).execute(env.client)
          ).getReceipt(env.client);
  
          await (
              await (
                  await new TokenFreezeTransaction()
                      .setTokenId(token)
                      .setAccountId(account)
                      .freezeWith(env.client)
                      .sign(key)
              ).execute(env.client)
          ).getReceipt(env.client);
  
          const info = await new AccountInfoQuery()
              .setAccountId(account)
              .execute(env.client);
  
          const relationship = info.tokenRelationships.get(token);
  
          expect(relationship).to.be.not.null;
          expect(relationship.tokenId.toString()).to.be.equal(token.toString());
          expect(relationship.balance.toInt()).to.be.equal(0);
          expect(relationship.isKycGranted).to.be.false;
          expect(relationship.isFrozen).to.be.true;
  
          await env.close({ token });
      });
  
      it("should be executable with no tokens set", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          const key = PrivateKey.generateED25519();
  
          const response = await new AccountCreateTransaction()
              .setKey(key)
              .setInitialBalance(new Hbar(2))
              .execute(env.client);
  
          const account = (await response.getReceipt(env.client)).accountId;
  
          let err = false;
  
          try {
              await (
                  await (
                      await new TokenFreezeTransaction()
                          .setAccountId(account)
                          .freezeWith(env.client)
                          .sign(key)
                  ).execute(env.client)
              ).getReceipt(env.client);
          } catch (error) {
              err = error.toString().includes(Status.InvalidTokenId);
          }
  
          if (!err) {
              throw new Error("token freeze did not error");
          }
  
          await env.close();
      });
  
      it("should error when account ID is not set", async function () {
          this.timeout(120000);
  
          const env = await IntegrationTestEnv.new();
          const operatorId = env.operatorId;
          const operatorKey = env.operatorKey.publicKey;
  
          const response = await new TokenCreateTransaction()
              .setTokenName("ffff")
              .setTokenSymbol("F")
              .setDecimals(3)
              .setInitialSupply(1000000)
              .setTreasuryAccountId(operatorId)
              .setAdminKey(operatorKey)
              .setKycKey(operatorKey)
              .setFreezeKey(operatorKey)
              .setWipeKey(operatorKey)
              .setSupplyKey(operatorKey)
              .setFreezeDefault(false)
              .execute(env.client);
  
          const token = (await response.getReceipt(env.client)).tokenId;
  
          let err = false;
  
          try {
              await (
                  await new TokenFreezeTransaction()
                      .setTokenId(token)
                      .execute(env.client)
              ).getReceipt(env.client);
          } catch (error) {
              err = error.toString().includes(Status.InvalidAccountId);
          }
  
          if (!err) {
              throw new Error("token freeze did not error");
          }
  
          await env.close({ token });
      });
  });
  