diff --git a/schemas/common.json b/schemas/common.json index c03a8d89..ba66a7b5 100644 --- a/schemas/common.json +++ b/schemas/common.json @@ -907,6 +907,7 @@ "supply", "image" ], + "additionalProperties": false, "properties": { "price": { "type": "string" @@ -934,25 +935,59 @@ "attributes": { "type": "array", "items": { - "type": "object", - "required": [ - "title", - "type" - ], - "properties": { - "title": { - "type": "string" - }, - "type": { - "type": "string" - }, - "url": { - "type": "string" + "anyOf": [ + { + "type": "object", + "additionalProperties": false, + "required": [ + "title", + "type", + "id", + "owner" + ], + "properties": { + "type": { + "type": "string", + "const": "model" + }, + "title": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid" + }, + "owner": { + "type": "string" + } + } }, - "id": { - "type": "string" + { + "type": "object", + "additionalProperties": false, + "required": [ + "title", + "type", + "imageUrl", + "originalImageUrl" + ], + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "title": { + "type": "string" + }, + "imageUrl": { + "type": "string" + }, + "originalImageUrl": { + "type": "string" + } + } } - } + ] } } } diff --git a/test/helpers/utils.js b/test/helpers/utils.js index f05f053a..4aae8ea5 100644 --- a/test/helpers/utils.js +++ b/test/helpers/utils.js @@ -456,9 +456,15 @@ const nftMeta = { supply: 1, image: 'http://website.com/image.jpeg', attributes: [{ - title: 'test', + title: 'test_image', type: 'image', - url: 'http://test.com', + imageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + originalImageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + }, { + title: 'test_model', + type: 'model', + id: 'eda9b976-b467-4361-b9fc-b9162a14ee76', + owner: 'test_owner', }], }, }; diff --git a/test/suites/update.js b/test/suites/update.js index ac34a291..85804677 100644 --- a/test/suites/update.js +++ b/test/suites/update.js @@ -460,9 +460,15 @@ describe('update suite', function suite() { supply: 1, image: 'http://website.com/image.jpeg', attributes: [{ - title: 'test', + title: 'test_image', type: 'image', - url: 'http://test.com', + imageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + originalImageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + }, { + title: 'test_model', + type: 'model', + id: 'eda9b976-b467-4361-b9fc-b9162a14ee76', + owner: 'test_owner', }], }; @@ -486,9 +492,30 @@ describe('update suite', function suite() { assert.equal(fileInfo.file.nft.currency, 'usd'); assert.equal(fileInfo.file.nft.supply, 1); assert.equal(fileInfo.file.nft.image, 'http://website.com/image.jpeg'); - assert.equal(fileInfo.file.nft.attributes[0].title, 'test'); + + // Assertions for the first attribute + assert.equal(fileInfo.file.nft.attributes[0].title, 'test_image'); assert.equal(fileInfo.file.nft.attributes[0].type, 'image'); - assert.equal(fileInfo.file.nft.attributes[0].url, 'http://test.com'); + assert.equal( + fileInfo.file.nft.attributes[0].imageUrl, + 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg' + ); + assert.equal( + fileInfo.file.nft.attributes[0].originalImageUrl, + 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg' + ); + + // Assertions for the second attribute + assert.equal(fileInfo.file.nft.attributes[1].title, 'test_model'); + assert.equal(fileInfo.file.nft.attributes[1].type, 'model'); + assert.equal( + fileInfo.file.nft.attributes[1].id, + 'eda9b976-b467-4361-b9fc-b9162a14ee76' + ); + assert.equal( + fileInfo.file.nft.attributes[1].owner, + 'test_owner' + ); }); }); @@ -670,9 +697,15 @@ describe('update suite', function suite() { supply: 1, image: 'http://website.com/image.jpeg', attributes: [{ - title: 'test', + title: 'test_image', type: 'image', - url: 'http://test.com', + imageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + originalImageUrl: 'f47bfb7e0c6ad240046c0c9839e17186/af378b9c-83fb-4be9-a204-e7e690334702/b7b91787-61bc-4e15-a18a-924198dc959f.jpeg', + }, { + title: 'test_model', + type: 'model', + id: 'eda9b976-b467-4361-b9fc-b9162a14ee76', + owner: 'test_owner', }], }, },