Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
ziaukhan committed Apr 13, 2022
1 parent 6b162e3 commit d6c78f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 10 additions & 3 deletions step08A_nft_erc721_OpenZeppelin/dist/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ describe("ApartmentCollection", function () {
const ApartmentCollection = await hardhat_1.ethers.getContractFactory("ApartmentCollection");
const apartmentCollection = await ApartmentCollection.deploy();
await apartmentCollection.deployed();
/*
await apartmentCollection.on("Transfer", (from, to, tokenId) => {
console.log("Token ID: " + tokenId);
});
await apartmentCollection.mint(owner.address);
console.log("Token ID: " + tokenId);
});*/
const txt1 = await apartmentCollection.mint(owner.address);
const receipt1 = await txt1.wait();
chai_1.expect(await (await (apartmentCollection.balanceOf(owner.address))).eq(1));
//console.log("txt1 = ",txt1);
//console.log("receipt1 = ",receipt1);
const eventArgs = receipt1.events ? receipt1.events[0].args : "";
const tokenId = eventArgs ? eventArgs["tokenId"].toString() : " N/A";
console.log("Token Id = ", tokenId);
});
});
14 changes: 9 additions & 5 deletions step08A_nft_erc721_OpenZeppelin/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ describe("ApartmentCollection", function () {
const apartmentCollection: ApartmentCollection = await ApartmentCollection.deploy();
await apartmentCollection.deployed();

/*
await apartmentCollection.on("Transfer", (from, to, tokenId) => {
console.log("Token ID: " + tokenId);
});
});*/

const txt1:ContractTransaction = await apartmentCollection.mint(owner.address);
const receipt1:ContractReceipt = await txt1.wait();
console.log("txt1 = ",txt1);
console.log("receipt1 = ",receipt1);
const eventArgs = receipt1.events? receipt1.events[0].args : "";
console.log("Token Id = ",eventArgs?eventArgs["tokenId"].toString():" N/A");
expect(await (await (apartmentCollection.balanceOf(owner.address))).eq(1));

//console.log("txt1 = ",txt1);
//console.log("receipt1 = ",receipt1);
const eventArgs = receipt1.events? receipt1.events[0].args : "";
const tokenId = eventArgs?eventArgs["tokenId"].toString():" N/A";
console.log("Token Id = ", tokenId);
expect(await apartmentCollection.ownerOf(tokenId)).to.equal(owner.address);


});

Expand Down

0 comments on commit d6c78f2

Please sign in to comment.