more fixes
This commit is contained in:
parent
c2fa7fe42e
commit
a9464e5119
|
@ -108,7 +108,7 @@ describe('Fixed Rate Exchange tests', async () => {
|
|||
fixedRate: price,
|
||||
marketFee: publishMarketSwapFee,
|
||||
allowedConsumer: ZERO_ADDRESS,
|
||||
withMint: false
|
||||
withMint: true
|
||||
}
|
||||
|
||||
const result = await Factory.createNftWithDatatokenWithFixedRate(
|
||||
|
@ -378,7 +378,7 @@ describe('Fixed Rate Exchange tests', async () => {
|
|||
fixed.allowedSwapper === ZERO_ADDRESS,
|
||||
'incorrect value for: allowedSwapper'
|
||||
)
|
||||
assert(fixed.withMint === null, 'incorrect value for: withMint')
|
||||
assert(fixed.withMint === true, 'incorrect value for: withMint')
|
||||
assert(fixed.isMinter === null, 'incorrect value for: isMinter')
|
||||
assert(fixed.updates, 'incorrect value for: updates.id')
|
||||
assert(fixed.swaps, 'incorrect value for: swaps')
|
||||
|
@ -496,65 +496,6 @@ describe('Fixed Rate Exchange tests', async () => {
|
|||
'incorrect value: 3nd eventIndex'
|
||||
)
|
||||
})
|
||||
it('Deactivates exchange', async () => {
|
||||
const deactiveQuery = {
|
||||
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
|
||||
}
|
||||
|
||||
const initialResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(deactiveQuery)
|
||||
})
|
||||
const initialActive = (await initialResponse.json()).data.fixedRateExchange
|
||||
.active
|
||||
assert(initialActive === true, 'incorrect value for: initialActive')
|
||||
|
||||
// Deactivate exchange
|
||||
await fixedRate.deactivate(publisher, exchangeId)
|
||||
await sleep(sleepMs)
|
||||
|
||||
// Check the updated value for active
|
||||
const updatedResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(deactiveQuery)
|
||||
})
|
||||
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
|
||||
|
||||
assert(updatedActive.active === false, 'incorrect value for: updatedActive')
|
||||
assert(
|
||||
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
|
||||
'incorrect value: eventIndex'
|
||||
)
|
||||
})
|
||||
|
||||
it('Activates exchange', async () => {
|
||||
const activeQuery = {
|
||||
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
|
||||
}
|
||||
const initialResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(activeQuery)
|
||||
})
|
||||
const initialActive = (await initialResponse.json()).data.fixedRateExchange
|
||||
.active
|
||||
assert(initialActive === false, 'incorrect value for: initialActive')
|
||||
|
||||
// Activate exchange
|
||||
await fixedRate.activate(publisher, exchangeId)
|
||||
await sleep(sleepMs)
|
||||
|
||||
// Check the updated value for active
|
||||
const updatedResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(activeQuery)
|
||||
})
|
||||
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
|
||||
assert(updatedActive.active === true, 'incorrect value for: updatedActive')
|
||||
assert(
|
||||
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
|
||||
'incorrect value: eventIndex'
|
||||
)
|
||||
})
|
||||
|
||||
it('Activate Minting', async () => {
|
||||
const mintingQuery = {
|
||||
|
@ -758,4 +699,63 @@ describe('Fixed Rate Exchange tests', async () => {
|
|||
'incorrect value for: eventIndex'
|
||||
)
|
||||
})
|
||||
it('Deactivates exchange', async () => {
|
||||
const deactiveQuery = {
|
||||
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
|
||||
}
|
||||
|
||||
const initialResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(deactiveQuery)
|
||||
})
|
||||
const initialActive = (await initialResponse.json()).data.fixedRateExchange
|
||||
.active
|
||||
assert(initialActive === true, 'incorrect value for: initialActive')
|
||||
|
||||
// Deactivate exchange
|
||||
await fixedRate.deactivate(publisher, exchangeId)
|
||||
await sleep(sleepMs)
|
||||
|
||||
// Check the updated value for active
|
||||
const updatedResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(deactiveQuery)
|
||||
})
|
||||
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
|
||||
|
||||
assert(updatedActive.active === false, 'incorrect value for: updatedActive')
|
||||
assert(
|
||||
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
|
||||
'incorrect value: eventIndex'
|
||||
)
|
||||
})
|
||||
|
||||
it('Activates exchange', async () => {
|
||||
const activeQuery = {
|
||||
query: `query {fixedRateExchange(id: "${fixedRateId}"){active, eventIndex}}`
|
||||
}
|
||||
const initialResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(activeQuery)
|
||||
})
|
||||
const initialActive = (await initialResponse.json()).data.fixedRateExchange
|
||||
.active
|
||||
assert(initialActive === false, 'incorrect value for: initialActive')
|
||||
|
||||
// Activate exchange
|
||||
await fixedRate.activate(publisher, exchangeId)
|
||||
await sleep(sleepMs)
|
||||
|
||||
// Check the updated value for active
|
||||
const updatedResponse = await fetch(subgraphUrl, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(activeQuery)
|
||||
})
|
||||
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
|
||||
assert(updatedActive.active === true, 'incorrect value for: updatedActive')
|
||||
assert(
|
||||
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
|
||||
'incorrect value: eventIndex'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue