From 3919bf7b2d36757c484763f587346a4d4eb9d15b Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Wed, 21 Dec 2022 14:56:50 +0000 Subject: [PATCH] Adding the key-value store steps to CodeExamples.test.ts --- package.json | 1 + test/integration/CodeExamples.test.ts | 29 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/package.json b/package.json index cf1e8e4e..7a502980 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/integration/CodeExamples.test.ts b/test/integration/CodeExamples.test.ts index fd1737ca..c40a8d2c 100644 --- a/test/integration/CodeExamples.test.ts +++ b/test/integration/CodeExamples.test.ts @@ -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