Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Commit

Permalink
feat: #61 Allow to set private key
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudinertia committed Jan 23, 2019
1 parent 6dd30c8 commit ea85ddf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
8 changes: 1 addition & 7 deletions packages/vvisp-utils/test/getPrivateKey.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,20 @@ describe('# getPrivateKey test', function() {
});
});
describe('private key enable', function() {
const mnemonic = process.env.MNEMONIC;
const private_key = process.env.PRIVATE_KEY;
before(function() {
delete process.env.MNEMONIC;
process.env.PRIVATE_KEY =
'9741fa712a6912b862c9043f8752ffae513cb01895985998c61620da5aaf2d2d';
});
after(function() {
process.env.MNEMONIC = mnemonic;
process.env.PRIVATE_KEY = private_key;
});
it('should pass when private key given', function() {
const result = getPrivateKey();
result.should.equal(process.env.PRIVATE_KEY);
});
it('should return private key instead of mnemonic', function() {
const result = getPrivateKey(
'piano garage flag neglect spare title drill basic strong aware enforce fury',
3
);
const result = getPrivateKey(MNEMONIC, 3);
result.should.equal(process.env.PRIVATE_KEY);
});
});
Expand Down
25 changes: 16 additions & 9 deletions packages/vvisp/test/scripts/deploy-contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ describe('# deploy contract process test', function() {
.fulfilled;
});

it('should deploy one contract through private key', async () => {
process.env.PRIVATE_KEY =
'9741fa712a6912b862c9043f8752ffae513cb01895985998c61620da5aaf2d2d';
process.env.MNEMONIC = '';
await deployContract(CONTRACT_PATH, [], { silent: true }).should.be
.fulfilled;
process.env.PRIVATE_KEY = '';
process.env.MNEMONIC =
'piano garage flag neglect spare title drill basic strong aware enforce fury';
describe('private key', function() {
const mnemonic = process.env.MNEMONIC;
const private_key = process.env.PRIVATE_KEY;
before(function() {
process.env.PRIVATE_KEY =
'9741fa712a6912b862c9043f8752ffae513cb01895985998c61620da5aaf2d2d';
delete process.env.MNEMONIC;
});
after(function() {
process.env.MNEMONIC = mnemonic;
process.env.PRIVATE_KEY = private_key;
});
it.only('should deploy one contract through private key', async () => {
await deployContract(CONTRACT_PATH, [], { silent: true }).should.be
.fulfilled;
});
});

it('should deploy two contract', async () => {
Expand Down

0 comments on commit ea85ddf

Please sign in to comment.