Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Last active August 24, 2021 18:45
Show Gist options
  • Save polluterofminds/1f83cc9a4366749eb2ec5861638a5f54 to your computer and use it in GitHub Desktop.
Save polluterofminds/1f83cc9a4366749eb2ec5861638a5f54 to your computer and use it in GitHub Desktop.
PFPinata Contract test
const { expect } = require("chai");
const { ethers } = require("hardhat");
const BASE_URI = "ipfs://FAKE_IPFS_CID/";
const TEST_WALLET = "0x243dc2F47EC5A0693C5c7bD39b31561cCd4B0e97";
describe("PFPinatas", function () {
it("Should mint a new token", async function () {
const PFPinata = await ethers.getContractFactory("PFPinatas");
const pfpPinata = await PFPinata.deploy(BASE_URI);
await pfpPinata.deployed();
await pfpPinata.mintTo(TEST_WALLET);
expect(await pfpPinata.ownerOf(1)).to.equal(TEST_WALLET);
});
it("Should return a valid token URI", async function () {
const PFPinata = await ethers.getContractFactory("PFPinatas");
const pfpPinata = await PFPinata.deploy(BASE_URI);
await pfpPinata.deployed(BASE_URI);
await pfpPinata.mintTo(TEST_WALLET);
expect(await pfpPinata.ownerOf(1)).to.equal(TEST_WALLET);
expect(await pfpPinata.tokenURI(1)).to.equal(`${BASE_URI}1`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment