From 99a6f88a92c03062efec5da8a58c45a6785c3e0d Mon Sep 17 00:00:00 2001 From: Stoyan Zhekov Date: Sun, 16 May 2021 11:40:17 +0900 Subject: [PATCH] Add error response integration tests --- package.json | 2 +- test/v4/integration/nft.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 144a27b..77e8141 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "coverage": "nyc report --reporter=text-lcov | coveralls", "coverage:report": "export NETWORK=mainnet && nyc --reporter=html mocha --timeout 25000 test/v4/", "docs": "./node_modules/.bin/apidoc -i src/routes/v4 -o docs", - "test:temp1": "export NETWORK=mainnet && export TEST=integration && mocha --exit --timeout 25000 -g '#getNftChildren' test/v4/integration/", + "test:temp1": "export NETWORK=mainnet && export TEST=integration && export SLPDB_URL=https://slpdb.fountainhead.cash/ && mocha --exit --timeout 25000 -g '#nft' test/v4/integration/", "test:temp2": "mocha -g '#getNftGroup' --exit --timeout 30000 test/v4/" }, "engines": { diff --git a/test/v4/integration/nft.js b/test/v4/integration/nft.js index f26e686..563b4f2 100644 --- a/test/v4/integration/nft.js +++ b/test/v4/integration/nft.js @@ -35,6 +35,31 @@ describe('#nft', () => { }) describe('#getNftChildren', () => { + it('should return error on non-existing NFT group token', async () => { + req.params.tokenId = + '68cd33ecd909068fbea318ae5ff1d6207cf754e53b191327d6d73b6916424c0b' + const result = await slp.getNftChildren(req, res) + // console.log(`result: ${util.inspect(result)}`) + + assert.include( + result.error, + 'NFT group does not exists', + 'Error message expected' + ) + }) + it('should return error on non-group NFT token', async () => { + req.params.tokenId = + '45a30085691d6ea586e3ec2aa9122e9b0e0d6c3c1fd357decccc15d8efde48a9' + + const result = await slp.getNftChildren(req, res) + // console.log(`result: ${JSON.stringify(result, null, 2)}`) + + assert.include( + result.error, + 'NFT group does not exists', + 'Error message expected' + ) + }) it('should get NFT children list', async () => { req.params.tokenId = '68cd33ecd909068fbea318ae5ff1d6207cf754e53b191327d6d73b6916424c0a' @@ -56,6 +81,18 @@ describe('#nft', () => { }) describe('#getNftGroup', () => { + it('should return error on non-existing NFT child token', async () => { + req.params.tokenId = + '45a30085691d6ea586e3ec2aa9122e9b0e0d6c3c1fd357decccc15d8efde48a8' + const result = await slp.getNftGroup(req, res) + // console.log(`result: ${util.inspect(result)}`) + + assert.include( + result.error, + 'NFT child does not exists', + 'Error message expected' + ) + }) it('should get NFT group token info', async () => { req.params.tokenId = '45a30085691d6ea586e3ec2aa9122e9b0e0d6c3c1fd357decccc15d8efde48a9'