Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Feb 28, 2024
1 parent f21a405 commit 03fb676
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/ethernaut-signer/test/tasks/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ const storage = require('ethernaut-signer/src/internal/storage')
describe('add', function () {
const terminal = new Terminal()

const demoSig = {
address: '0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f',
pk: '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97',
}

const removeTestSigners = function () {
const signers = storage.readSigners()
if ('test__1' in signers) delete signers.test__1
storage.storeSigners(signers)
}

before('remove test networks', removeTestSigners)
after('remove test networks', removeTestSigners)
before('remove test signers', removeTestSigners)
after('remove test signers', removeTestSigners)

describe('when all params are specified', function () {
before('run add', async function () {
await terminal.run('npx hardhat sig add test__1 --pk 0x123')
await terminal.run(`npx hardhat sig add test__1 --pk ${demoSig.pk}`)
})

it('adds the signer', async function () {
const signers = storage.readSigners()
assert.deepEqual(signers.test__1, { pk: '0x123' })
assert.deepEqual(
signers.test__1,
{ address: demoSig.address, pk: demoSig.pk },
terminal.output,
)
})
})
})

0 comments on commit 03fb676

Please sign in to comment.