-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
153 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SDK-E2E-Tests | ||
|
||
This project dedicates to perform e2e test for the story protocol typescript sdk. | ||
|
||
## Prerequisites to run the e2e test | ||
|
||
- install nvm if don't have it by running: | ||
|
||
`curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash`. | ||
|
||
- run `nvm use` to switch node version to v20.0.0 | ||
- if you don't have v20.0.0 node installed, please install it by running: `nvm install v20.0.0` | ||
|
||
- run `npm i` to install dependencies. | ||
- once all dependencies are installed, you should config your `.env` file with a reference to the `.env.example` file | ||
|
||
## How to run the test | ||
|
||
- Run specific test (recommend): | ||
|
||
run `npm run test:flow1` | ||
|
||
- Run all test together: | ||
|
||
run `npm run test` | ||
|
||
## How can I extend test flows to this project | ||
|
||
- wrap your test flow into a function and default export this function. | ||
- put the new test file into `/test/e2e/flows` | ||
- import the function from `/test/e2e/e2e.ts`, and register it into `flowsTestMap` | ||
- extend the `scripts` field of the `/package.json` file with a reference to the existing other scrip command, and finally add the flow name to `TEST_FLOWS` in 'test' of the 'scripts' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import { Hex } from 'viem'; | ||
import { mintNFT, registerRootIp, registerSocialRemixPolicy, registerDerivativeIP, mintLicense, sleep } from '../../../utils/utils'; | ||
import { | ||
mintNFT, | ||
registerRootIp, | ||
registerSocialRemixPolicy, | ||
registerDerivativeIP, | ||
mintLicense, | ||
sleep, | ||
} from '../../../utils/utils'; | ||
|
||
export default async function testFlow1() { | ||
// const NFTIdOfA = await mintNFT('A'); | ||
// const NFTIdOfB = await mintNFT('B'); | ||
const NFTIdOfA = await mintNFT('A'); | ||
const NFTIdOfB = await mintNFT('B'); | ||
const policyId = await registerSocialRemixPolicy(); | ||
const NFTIdOfA = '200'; | ||
const NFTIdOfB = '207'; | ||
await sleep(5); | ||
const ipId = (await registerRootIp(NFTIdOfA)) as Hex; | ||
await sleep(5); | ||
if (!ipId || !policyId) return; | ||
const licenseId = await mintLicense(ipId, policyId, 'B', 'A'); | ||
await sleep(5); | ||
await sleep(30); | ||
if (!licenseId) return; | ||
registerDerivativeIP(NFTIdOfB, [licenseId], 'B'); | ||
await registerDerivativeIP(NFTIdOfB, [licenseId], 'B'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Hex } from 'viem'; | ||
import { mintNFT, registerRootIp, registerDerivativeIP, mintLicense, sleep } from '../../../utils/utils'; | ||
|
||
// No policy should impossible to mint license | ||
export default async function testFlow7() { | ||
try { | ||
const NFTIdOfA = await mintNFT('A'); | ||
await sleep(5); | ||
const ipId = (await registerRootIp(NFTIdOfA)) as Hex; | ||
await sleep(5); | ||
if (!ipId) return; | ||
const licenseId = await mintLicense(ipId, '0', 'B', 'A'); | ||
} catch (error) { | ||
console.log('cannot mint license without policy, it is expected behavior'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters