diff --git a/package.json b/package.json index b5f46eb..401b22a 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/e2e/derivativeIP.comRemixPIL.test.ts b/test/e2e/derivativeIP.comRemixPIL.test.ts index 7d20a37..7db8bc0 100644 --- a/test/e2e/derivativeIP.comRemixPIL.test.ts +++ b/test/e2e/derivativeIP.comRemixPIL.test.ts @@ -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; @@ -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) diff --git a/tsconfig.json b/tsconfig.json index ec628e6..d8f735a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"], } \ No newline at end of file