Skip to content

Commit 15dead1

Browse files
committed
Fix test cases after merge & code review feedback
1 parent 9beb8b9 commit 15dead1

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed

migrations/6_initialize_721token.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = async (deployer, network, accounts) => {
2323

2424
case 'rinkeby':
2525
erc20TokenAddress = '0xb05e292f89c6a82f5ed1be694dc7b6444866b364'
26-
initialFees = 10 ** 18 // 1 token
26+
initialFees = web3.toWei(1, 'ether')
2727
break
2828

2929
default:

test/helpers/modifyMetadataHashes.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function modifyMetadataHashes({
2525

2626
// If fees are enabled, a Transfer event is fired in addition to the Modified event
2727
const expectedLogsLength = feesEnabled ? 2 : 1
28-
const logIndex = feesEnabled ? 1 : 0
28+
const expectedEventIndex = feesEnabled ? 1 : 0
2929

3030
const { logs } = await this.token.modifyMetadataHashes(
3131
this.tokenId,
@@ -50,13 +50,12 @@ export default async function modifyMetadataHashes({
5050

5151
logs.length.should.be.equal(expectedLogsLength)
5252

53-
logs[logIndex].event.should.be.eq('Modified')
54-
logs[logIndex].args._from.should.be.equal(this.creator)
55-
logs[logIndex].args._tokenId.should.be.bignumber.equal(this.tokenId)
56-
logs[logIndex].args._newNameHash.should.be.equal(tokenData[0])
57-
logs[logIndex].args._newDescriptionHash.should.be.equal(tokenData[1])
58-
logs[logIndex].args._newFileHashes.should.deep.equal(tokenData[2])
59-
logs[logIndex].args._providerId.should.be.equal(providerId)
60-
logs[logIndex].args._providerMetadataId.should.be.equal(providerMetadataId)
61-
53+
logs[expectedEventIndex].event.should.be.eq('Modified')
54+
logs[expectedEventIndex].args._from.should.be.equal(this.creator)
55+
logs[expectedEventIndex].args._tokenId.should.be.bignumber.equal(this.tokenId)
56+
logs[expectedEventIndex].args._newNameHash.should.be.equal(tokenData[0])
57+
logs[expectedEventIndex].args._newDescriptionHash.should.be.equal(tokenData[1])
58+
logs[expectedEventIndex].args._newFileHashes.should.deep.equal(tokenData[2])
59+
logs[expectedEventIndex].args._providerId.should.be.equal(providerId)
60+
logs[expectedEventIndex].args._providerMetadataId.should.be.equal(providerMetadataId)
6261
}

test/token/behaviors/CodexTitle.behavior.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -169,49 +169,51 @@ export default function shouldBehaveLikeCodexTitle(accounts, metadata, feesEnabl
169169
})
170170
})
171171

172-
describe('metadata', function () {
173-
it('should have the correct name', async function () {
174-
const name = await this.token.name()
175-
name.should.be.equal('Codex Title')
176-
})
177-
178-
it('should have the correct symbol', async function () {
179-
const symbol = await this.token.symbol()
180-
symbol.should.be.equal('CT')
181-
})
182-
183-
describe('tokenURI', function () {
184-
it('should be empty by default', async function () {
185-
const tokenURI = await this.token.tokenURI(firstTokenId)
186-
tokenURI.should.be.equal('')
172+
if (!feesEnabled) {
173+
describe('metadata', function () {
174+
it('should have the correct name', async function () {
175+
const name = await this.token.name()
176+
name.should.be.equal('Codex Title')
187177
})
188178

189-
describe('tokenURIPrefix', function () {
190-
const constantTokenURIPrefix = 'https://codexprotocol.com/token/'
179+
it('should have the correct symbol', async function () {
180+
const symbol = await this.token.symbol()
181+
symbol.should.be.equal('CT')
182+
})
191183

184+
describe('tokenURI', function () {
192185
it('should be empty by default', async function () {
193-
const tokenURIPrefix = await this.token.tokenURIPrefix()
194-
tokenURIPrefix.should.be.equal('')
186+
const tokenURI = await this.token.tokenURI(firstTokenId)
187+
tokenURI.should.be.equal('')
195188
})
196189

197-
describe('when set by an address that is not the owner', function () {
198-
it('should fail', async function () {
199-
await assertRevert(this.token.setTokenURIPrefix(constantTokenURIPrefix, { from: unauthorized }))
190+
describe('tokenURIPrefix', function () {
191+
const constantTokenURIPrefix = 'https://codexprotocol.com/token/'
192+
193+
it('should be empty by default', async function () {
194+
const tokenURIPrefix = await this.token.tokenURIPrefix()
195+
tokenURIPrefix.should.be.equal('')
200196
})
201-
})
202197

203-
describe('when called by the owner', function () {
204-
beforeEach(async function () {
205-
await this.token.setTokenURIPrefix(constantTokenURIPrefix)
198+
describe('when set by an address that is not the owner', function () {
199+
it('should fail', async function () {
200+
await assertRevert(this.token.setTokenURIPrefix(constantTokenURIPrefix, { from: unauthorized }))
201+
})
206202
})
207203

208-
it('should update the URI for all tokens', async function () {
209-
const tokenURI = await this.token.tokenURI(firstTokenId)
210-
tokenURI.should.be.equal(`${constantTokenURIPrefix}${firstTokenId}`)
204+
describe('when called by the owner', function () {
205+
beforeEach(async function () {
206+
await this.token.setTokenURIPrefix(constantTokenURIPrefix)
207+
})
208+
209+
it('should update the URI for all tokens', async function () {
210+
const tokenURI = await this.token.tokenURI(firstTokenId)
211+
tokenURI.should.be.equal(`${constantTokenURIPrefix}${firstTokenId}`)
212+
})
211213
})
212214
})
213215
})
214216
})
215-
})
217+
}
216218
})
217219
}

test/token/behaviors/CodexTitleFees.behavior.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function shouldBehaveLikeCodexTitleWithFees(accounts, metadata) {
7575
creator,
7676
hashedMetadata.name,
7777
hashedMetadata.description,
78-
hashedMetadata.files[0],
78+
hashedMetadata.files,
7979
providerId,
8080
providerMetadataId,
8181
)
@@ -94,7 +94,7 @@ export default function shouldBehaveLikeCodexTitleWithFees(accounts, metadata) {
9494
creator,
9595
hashedMetadata.name,
9696
hashedMetadata.description,
97-
hashedMetadata.files[0],
97+
hashedMetadata.files,
9898
providerId,
9999
providerMetadataId,
100100
)

0 commit comments

Comments
 (0)