mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix test
This commit is contained in:
parent
bb24f07b17
commit
e43db262d8
@ -14,7 +14,7 @@ describe('Nonce Tracker', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 })
|
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 })
|
||||||
pendingTxs = txGen.generate({ status: 'pending' }, { count: 1 })
|
pendingTxs = txGen.generate({ status: 'submitted' }, { count: 1 })
|
||||||
nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs, '0x1')
|
nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs, '0x1')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ describe('Nonce Tracker', function () {
|
|||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 1 })
|
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 1 })
|
||||||
pendingTxs = txGen.generate({
|
pendingTxs = txGen.generate({
|
||||||
status: 'pending',
|
status: 'submitted',
|
||||||
txParams: { nonce: '0x01' },
|
txParams: { nonce: '0x01' },
|
||||||
}, { count: 5 })
|
}, { count: 5 })
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ describe('Nonce Tracker', function () {
|
|||||||
it('should return nonce after those', async function () {
|
it('should return nonce after those', async function () {
|
||||||
this.timeout(15000)
|
this.timeout(15000)
|
||||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
|
assert.equal(nonceLock.nextNonce, '2', `nonce should be 2 got ${nonceLock.nextNonce}`)
|
||||||
await nonceLock.releaseLock()
|
await nonceLock.releaseLock()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -76,7 +76,7 @@ describe('Nonce Tracker', function () {
|
|||||||
it('should return nonce after those', async function () {
|
it('should return nonce after those', async function () {
|
||||||
this.timeout(15000)
|
this.timeout(15000)
|
||||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
|
assert.equal(nonceLock.nextNonce, '2', `nonce should be 2 got ${nonceLock.nextNonce}`)
|
||||||
await nonceLock.releaseLock()
|
await nonceLock.releaseLock()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -84,14 +84,14 @@ describe('Nonce Tracker', function () {
|
|||||||
describe('when local pending count is higher than other metrics', function () {
|
describe('when local pending count is higher than other metrics', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
pendingTxs = txGen.generate({ status: 'pending' }, { count: 2 })
|
pendingTxs = txGen.generate({ status: 'submitted' }, { count: 2 })
|
||||||
nonceTracker = generateNonceTrackerWith(pendingTxs, [])
|
nonceTracker = generateNonceTrackerWith(pendingTxs, [])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return nonce after those', async function () {
|
it('should return nonce after those', async function () {
|
||||||
this.timeout(15000)
|
this.timeout(15000)
|
||||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
|
assert.equal(nonceLock.nextNonce, '2', `nonce should be 2 got ${nonceLock.nextNonce}`)
|
||||||
await nonceLock.releaseLock()
|
await nonceLock.releaseLock()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -99,21 +99,21 @@ describe('Nonce Tracker', function () {
|
|||||||
describe('when provider nonce is higher than other metrics', function () {
|
describe('when provider nonce is higher than other metrics', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const txGen = new MockTxGen()
|
const txGen = new MockTxGen()
|
||||||
pendingTxs = txGen.generate({ status: 'pending' }, { count: 2 })
|
pendingTxs = txGen.generate({ status: 'submitted' }, { count: 2 })
|
||||||
nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x05')
|
nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x05')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return nonce after those', async function () {
|
it('should return nonce after those', async function () {
|
||||||
this.timeout(15000)
|
this.timeout(15000)
|
||||||
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
|
||||||
assert.equal(nonceLock.nextNonce, '6', 'nonce should be 6')
|
assert.equal(nonceLock.nextNonce, '5', `nonce should be 5 got ${nonceLock.nextNonce}`)
|
||||||
await nonceLock.releaseLock()
|
await nonceLock.releaseLock()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function generateNonceTrackerWith(pending, confirmed, providerStub = '0x0') {
|
function generateNonceTrackerWith (pending, confirmed, providerStub = '0x0') {
|
||||||
const getPendingTransactions = () => pending
|
const getPendingTransactions = () => pending
|
||||||
const getConfirmedTransactions = () => confirmed
|
const getConfirmedTransactions = () => confirmed
|
||||||
providerResultStub.result = providerStub
|
providerResultStub.result = providerStub
|
||||||
|
Loading…
x
Reference in New Issue
Block a user