1234567891011121314151617import {expect} from 'chai';18import {createCollectionExpectSuccess} from '../util/helpers';19import {collectionIdToAddress, createEthAccountWithBalance, GAS_ARGS, itWeb3} from './util/helpers';20import fungibleMetadataAbi from './fungibleMetadataAbi.json';2122describe('Common metadata', () => {23 itWeb3('Returns collection name', async ({api, web3}) => {24 const collection = await createCollectionExpectSuccess({25 name: 'token name',26 mode: {type: 'NFT'},27 });28 const caller = await createEthAccountWithBalance(api, web3);2930 const address = collectionIdToAddress(collection);31 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address, {from: caller, ...GAS_ARGS});32 const name = await contract.methods.name().call();3334 expect(name).to.equal('token name');35 });3637 itWeb3('Returns symbol name', async ({api, web3}) => {38 const collection = await createCollectionExpectSuccess({39 tokenPrefix: 'TOK',40 mode: {type: 'NFT'},41 });42 const caller = await createEthAccountWithBalance(api, web3);4344 const address = collectionIdToAddress(collection);45 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address, {from: caller, ...GAS_ARGS});46 const symbol = await contract.methods.symbol().call();4748 expect(symbol).to.equal('TOK');49 });50});5152describe('Fungible metadata', () => {53 itWeb3('Returns fungible decimals', async ({api, web3}) => {54 const collection = await createCollectionExpectSuccess({55 mode: {type: 'Fungible', decimalPoints: 6},56 });57 const caller = await createEthAccountWithBalance(api, web3);5859 const address = collectionIdToAddress(collection);60 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address, {from: caller, ...GAS_ARGS});61 const decimals = await contract.methods.decimals().call();6263 expect(+decimals).to.equal(6);64 });65});