Skip to content

Commit

Permalink
test: freeze transaction after fromBytes
Browse files Browse the repository at this point in the history
Signed-off-by: Ivaylo Nikolov <[email protected]>
  • Loading branch information
ivaylonikolov7 committed Sep 25, 2024
1 parent fda7698 commit 16a476d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/integration/FileAppendIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,35 @@ describe("FileAppend", function () {
expect(content.size.toInt()).to.be.equal(NEW_CONTENTS_LENGTH);
});

it("should be able to freeze after deserialze", async function () {
this.timeout(120000);

const NEW_CONTENTS_LENGTH = 5000;
const NEW_CONTENTS = generateUInt8Array(NEW_CONTENTS_LENGTH);
const operatorKey = env.operatorKey.publicKey;

let response = await new FileCreateTransaction()
.setKeys([operatorKey])
.setContents(Buffer.from(""))
.execute(env.client);

let { fileId } = await response.getReceipt(env.client);

expect(fileId).to.not.be.null;
expect(fileId != null ? fileId.num > 0 : false).to.be.true;

const tx = new FileAppendTransaction()
.setFileId(fileId)
.setContents(NEW_CONTENTS);

const txBytes = tx.toBytes();
const txFromBytes = FileAppendTransaction.fromBytes(txBytes);

txFromBytes.freezeWith(env.client);

expect(txFromBytes.isFrozen()).to.be.true;
});

after(async function () {
await env.close();
});
Expand Down

0 comments on commit 16a476d

Please sign in to comment.