aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/unit/seed-phrase-verifier-test.js31
1 files changed, 8 insertions, 23 deletions
diff --git a/test/unit/seed-phrase-verifier-test.js b/test/unit/seed-phrase-verifier-test.js
index 654fb5994..4e314806b 100644
--- a/test/unit/seed-phrase-verifier-test.js
+++ b/test/unit/seed-phrase-verifier-test.js
@@ -13,20 +13,23 @@ describe('SeedPhraseVerifier', function () {
let hdKeyTree = 'HD Key Tree'
let keyringController
- beforeEach(function () {
+ let vault
+ let primaryKeyring
+
+ beforeEach(async function () {
keyringController = new KeyringController({
initState: clone(firstTimeState),
encryptor: mockEncryptor,
})
assert(keyringController)
+
+ vault = await keyringController.createNewVaultAndKeychain(password)
+ primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
})
it('should be able to verify created account with seed words', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
@@ -39,11 +42,9 @@ describe('SeedPhraseVerifier', function () {
it('should be able to verify created account (upper case) with seed words', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
+
let upperCaseAccounts = [createdAccounts[0].toUpperCase()]
let serialized = await primaryKeyring.serialize()
@@ -55,9 +56,6 @@ describe('SeedPhraseVerifier', function () {
it('should be able to verify created account (lower case) with seed words', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
let lowerCaseAccounts = [createdAccounts[0].toLowerCase()]
@@ -71,9 +69,6 @@ describe('SeedPhraseVerifier', function () {
it('should return error with good but different seed words', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
@@ -90,9 +85,6 @@ describe('SeedPhraseVerifier', function () {
it('should return error with undefined existing accounts', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
@@ -109,9 +101,6 @@ describe('SeedPhraseVerifier', function () {
it('should return error with empty accounts array', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
let createdAccounts = await primaryKeyring.getAccounts()
assert.equal(createdAccounts.length, 1)
@@ -128,10 +117,6 @@ describe('SeedPhraseVerifier', function () {
it('should be able to verify more than one created account with seed words', async function () {
- let vault = await keyringController.createNewVaultAndKeychain(password)
-
- let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
-
const keyState = await keyringController.addNewAccount(primaryKeyring)
const keyState2 = await keyringController.addNewAccount(primaryKeyring)