Contracts for Degen Domain Name Service
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
degen-contracts/test/nft/anon/anonMetadata.test.js

45 lines
1.4 KiB

// npx hardhat test test/nft/angel/angelMetadata.test.js
const { expect } = require("chai");
describe("Degen Anon Metadata", function () {
let metadataContract;
let signer;
beforeEach(async function () {
[signer] = await ethers.getSigners();
const DegenAnonMetadata = await ethers.getContractFactory("DegenAnonMetadata");
metadataContract = await DegenAnonMetadata.deploy();
await metadataContract.changeMinter(signer.address);
const features1 = "3A1174741911F257FFCA965A000000231"; // bg1, bg2, hair, skin, dress, face (0-3), arms (0-3), lips (0-2)
const domainPrice = ethers.utils.parseUnits("1", "ether");
await metadataContract.setUniqueFeaturesId(1, [features1], domainPrice);
});
it("should fetch and parse metadata", async function () {
const tokenId = 1;
const domainName = "techie";
const tld = ".degen";
const metadata = await metadataContract.getMetadata(domainName, tld, tokenId);
console.log(metadata)
const mdJson = Buffer.from(metadata.substring(29), "base64");
const mdResult = JSON.parse(mdJson);
// metadata:
//console.log(mdResult);
console.log(mdResult.name);
console.log(mdResult.attributes);
expect(mdResult.name).to.equal(domainName+tld);
expect(mdResult.description).to.equal("A collection of Degen Anon NFTs created by Degen Domain Service: https://degendomains.io/#/nft/angel");
// SVG image:
console.log(mdResult.image);
});
});