Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacqueline-57b committed Jul 25, 2024
1 parent 3927a66 commit 8593a24
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,28 @@
"viem": "^2.8.12"
},
"devDependencies": {
"@testdeck/mocha": "^0.3.3",
"@types/chai": "^4.3.12",
"@types/chai-as-promised": "^7.1.6",
"@types/mocha": "^10.0.2",
"@types/mocha": "^10.0.7",
"@types/mocha-steps": "^1.3.3",
"@types/mochawesome": "^6.2.4",
"@types/node": "^20.8.2",
"@types/sinon": "^10.0.18",
"allure-commandline": "^2.29.0",
"allure-decorators": "^2.15.1",
"allure-js-commons": "^3.0.0-beta.7",
"allure-mocha": "^3.0.0-beta.7",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"eslint": "^8.50.0",
"mocha": "^10.2.0",
"mocha": "^10.7.0",
"mocha-multi-reporters": "^1.5.1",
"mocha-steps": "^1.3.0",
"mochawesome": "^7.1.3",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typechain": "^8.3.1",
"typescript": "^5.4.2"
Expand Down
64 changes: 54 additions & 10 deletions test/e2e/derivativeIP.comRemixPIL.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ chai.use(chaiAsPromised);
import '../setup';
import { Hex } from 'viem';
import { comRemixLicenseTermsId1 } from '../setup';
require("mocha-allure-reporter");
declare const allure: any;

let tokenIdA: string;
let tokenIdB: string;
let tokenIdB: string;
let tokenIdC: string;
let ipIdA: Hex;
let ipIdB: Hex;
Expand All @@ -23,50 +25,92 @@ const waitForTransaction: boolean = true;

describe("SDK E2E Test - Register Derivative IP Asset with Commercial Remix PIL", function () {
describe.only("@smoke Register a derivative IP asset with/without license tokens", async function () {
step("Mint a NFT to Wallet A and get a tokenId (tokenIdA)", async function () {
allure.step("Mint a NFT to Wallet A and get a tokenId (tokenIdA)", async function (){
tokenIdA = await mintNFTWithRetry(privateKeyA);
checkMintResult(tokenIdA);

expect(tokenIdA).not.empty;
});
// step("Mint a NFT to Wallet A and get a tokenId (tokenIdA)", async function () {
// tokenIdA = await mintNFTWithRetry(privateKeyA);
// checkMintResult(tokenIdA);

step("Wallet A register an IP Asset with tokenIdA and get an ipId (ipIdA)", async function () {
// expect(tokenIdA).not.empty;
// });

allure.step("Wallet A register an IP Asset with tokenIdA and get an ipId (ipIdA)", async function () {
const response = await expect(
registerIpAsset("A", nftContractAddress, tokenIdA, waitForTransaction)
).to.not.be.rejected;

expect(response.txHash).to.be.a("string").and.not.empty;
expect(response.ipId).to.be.a("string").and.not.empty;

ipIdA = response.ipId;
});
});

step("Wallet A attach comRemixLicenseTermsId1(commercial remix PIL) to ipIdA", async function () {
// step("Wallet A register an IP Asset with tokenIdA and get an ipId (ipIdA)", async function () {
// const response = await expect(
// registerIpAsset("A", nftContractAddress, tokenIdA, waitForTransaction)
// ).to.not.be.rejected;

// expect(response.txHash).to.be.a("string").and.not.empty;
// expect(response.ipId).to.be.a("string").and.not.empty;

// ipIdA = response.ipId;
// });

allure.step("Wallet A attach comRemixLicenseTermsId1(commercial remix PIL) to ipIdA", async function () {
const response = await expect(
attachLicenseTerms("A", ipIdA, comRemixLicenseTermsId1, waitForTransaction)
).to.not.be.rejected;

expect(response.txHash).to.be.a("string").and.not.empty;
expect(response.txHash).to.be.a("string").and.not.empty;
});
// step("Wallet A attach comRemixLicenseTermsId1(commercial remix PIL) to ipIdA", async function () {
// const response = await expect(
// attachLicenseTerms("A", ipIdA, comRemixLicenseTermsId1, waitForTransaction)
// ).to.not.be.rejected;

step("Wallet A mint a license token with the receiverAddress set as Wallet B, get a licenseTokenId (licenseTokenIdA)", async function () {
// expect(response.txHash).to.be.a("string").and.not.empty;
// });

allure.step("Wallet A mint a license token with the receiverAddress set as Wallet B, get a licenseTokenId (licenseTokenIdA)", async function () {
const response = await expect(
mintLicenseTokens("A", ipIdA, comRemixLicenseTermsId1, 2, accountB.address, waitForTransaction)
mintLicenseTokens("A", ipIdA, comRemixLicenseTermsId1, 1, accountB.address, waitForTransaction)
).to.not.be.rejected;


expect(response.txHash).to.be.a("string").and.not.empty;
expect(response.licenseTokenIds).to.be.a("array").and.to.have.lengthOf(2);

licenseTokenIdA= response.licenseTokenIds[0];
});

step("Mint a NFT to Wallet B and get a tokenId (tokenIdB)", async function () {
// step("Wallet A mint a license token with the receiverAddress set as Wallet B, get a licenseTokenId (licenseTokenIdA)", async function () {
// const response = await expect(
// mintLicenseTokens("A", ipIdA, comRemixLicenseTermsId1, 2, accountB.address, waitForTransaction)
// ).to.not.be.rejected;

// expect(response.txHash).to.be.a("string").and.not.empty;
// expect(response.licenseTokenIds).to.be.a("array").and.to.have.lengthOf(2);

// licenseTokenIdA= response.licenseTokenIds[0];
// });

allure.step("Mint a NFT to Wallet B and get a tokenId (tokenIdB)", async function () {
tokenIdB = await mintNFTWithRetry(privateKeyB);
checkMintResult(tokenIdB);

expect(tokenIdB).not.empty;
});

// step("Mint a NFT to Wallet B and get a tokenId (tokenIdB)", async function () {
// tokenIdB = await mintNFTWithRetry(privateKeyB);
// checkMintResult(tokenIdB);

// expect(tokenIdB).not.empty;
// });

step("Wallet B register an IP Asset with tokenIdB and get an ipId (ipIdB)", async function () {
const response = await expect(
registerIpAsset("B", nftContractAddress, tokenIdB, waitForTransaction)
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"module": "commonjs",
"target": "ES2020",
"esModuleInterop": true,
"strict": true
"strict": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": ["./node_modules/@types", "./@types"]
},
"include": ["test", "config", "utils"],
}

0 comments on commit 8593a24

Please sign in to comment.