1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Adding the key-value store steps to CodeExamples.test.ts

This commit is contained in:
Jamie Hewitt 2022-12-21 14:56:50 +00:00
parent aef17e96d4
commit 3919bf7b2d
2 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,7 @@
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
"test:unit:cover": "nyc --report-dir coverage/unit --exclude 'src/@types/**/*' npm run test:unit",
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
"test:guide": "npm run mocha -- 'test/integration/CodeExamples.test.ts'",
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
"create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
"create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",

View File

@ -676,6 +676,35 @@ describe('Marketplace flow tests', async () => {
}
}) ///
/// ```
it('8.1 Add key-value pair to data NFT', async () => {
/// ```Typescript
const nft = new Nft(web3)
const data = 'SomeData'
try {
/// Use the `setData` method to update the nft key value store with some data
await nft.setData(freNftAddress, publisherAccount, '1', data)
} catch (e) {
console.error(e)
assert.fail('Download failed')
}
/// ```
}) ///
it('8.2 Add key-value pair to data NFT', async () => {
/// ```Typescript
const nft = new Nft(web3)
try {
/// Use the `getData` method to get the data stored in the nft key value store
const data = await nft.getData(freNftAddress, '1')
console.log('Data: ', data)
} catch (e) {
console.error(e)
assert.fail('Download failed')
}
/// ```
}) ///
/// ```
}) ///
/// ## Editing this file