Skip to content

Commit

Permalink
Database and storage refactoring (symbol#177)
Browse files Browse the repository at this point in the history
* Database and storage refactoring.

* Fixes after merge

* Fixed language picker
fixed mosaic and namespace links
Moved transactions to own module
Improved balance component
Improved how blocks are loaded
Improved Amount shown in transaction table
fixed load account info dispatch
Fixed account creation
Small fixes

* Fixed merge

* Fixed copyToClipboard
Fixed MosaicAmountDisplay ticker of custom mosaic
Simplified code around peer selector
Tune how much information is loaded when peer is changed

* Account names refresh when changed

* Fixed login autocomplete

* Fixed settings

* Fixed warning

* Fixed eslint

* Improved peer selection process
Mosaic Tables shown owned and balance mosaics

* Added peer order

* Fixed import

* Fixed Address alias display
Improved Transaction View types

* Improved peer selector when adding a new host
Disabled known nodes from peers

* fixed lint

* fix on-logout wallet details destroy issue

Co-authored-by: Gregory Saive <[email protected]>
  • Loading branch information
fboucquez and evias committed Apr 22, 2020
1 parent de748fc commit f078610
Show file tree
Hide file tree
Showing 292 changed files with 5,626 additions and 11,042 deletions.
75 changes: 0 additions & 75 deletions __mocks__/Database.ts

This file was deleted.

28 changes: 14 additions & 14 deletions __mocks__/Wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {SimpleWallet, Account, NetworkType, Password} from 'symbol-sdk';

// internal dependencies
import {WalletsModel, WalletType} from '@/core/database/entities/WalletsModel';
import {WalletModel, WalletType} from '@/core/database/entities/WalletModel';

export const wallet1Params = {
walletName: 'wallet_name',
Expand All @@ -37,16 +37,16 @@ export const simpleWallet1 = SimpleWallet.createFromPrivateKey(
wallet1Params.networkType,
)

export const WalletsModel1 = new WalletsModel(
new Map<string, any>([
['accountName', 'account_name'],
['name', wallet1Params.walletName],
['type', WalletType.fromDescriptor('Pk')],
['address', simpleWallet1.address.plain()],
['publicKey', wallet1Account.publicKey],
['encPrivate', simpleWallet1.encryptedPrivateKey.encryptedKey],
['encIv', simpleWallet1.encryptedPrivateKey.iv],
['path', ''],
['isMultisig', false],
])
)
export const WalletsModel1: WalletModel = {
id: 'someId',
node: '',
accountName: 'account_name',
name: wallet1Params.walletName,
type: WalletType.PRIVATE_KEY,
address: simpleWallet1.address.plain(),
publicKey: wallet1Account.publicKey,
encPrivate: simpleWallet1.encryptedPrivateKey.encryptedKey,
encIv: simpleWallet1.encryptedPrivateKey.iv,
path: '',
isMultisig: false
}
28 changes: 14 additions & 14 deletions __tests__/components/MosaicInputManager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import {Mosaic, MosaicId, UInt64} from 'symbol-sdk'
import {MosaicInputsManager} from '@/views/forms/FormTransferTransaction/MosaicInputsManager.ts'
import {MosaicModel} from '@/core/database/entities/MosaicModel'

export const mockMosaic1 = new Mosaic(
new MosaicId('619CE7E50DB644DE'),
UInt64.fromUint(1),
)
export const mockMosaic1: MosaicModel = {
mosaicIdHex: '619CE7E50DB644DE',
balance: 1,
} as MosaicModel

export const mockMosaic2 = new Mosaic(
new MosaicId('28A59CC8B0C9E4DD'),
UInt64.fromUint(1),
)
export const mockMosaic2: MosaicModel = {
mosaicIdHex: '28A59CC8B0C9E4DD',
balance: 1,
} as MosaicModel

export const mockMosaic3 = new Mosaic(
new MosaicId('2D58F9BF5F8C014D'),
UInt64.fromUint(1),
)
export const mockMosaic3: MosaicModel = {
mosaicIdHex: '2D58F9BF5F8C014D',
balance: 1,
} as MosaicModel

const mockMosaics = [ mockMosaic1, mockMosaic2, mockMosaic3 ]
const mockMosaicHexIds = mockMosaics.map(({id}) => id.toHex())
const mockMosaicHexIds = mockMosaics.map(({mosaicIdHex}) => mosaicIdHex)

describe('components/MosaicInputManager', () => {
describe('initialize() should', () => {
Expand Down
28 changes: 6 additions & 22 deletions __tests__/components/WalletSelectorField.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
/**
* Copyright 2020 NEM Foundation (https://nem.io)
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// internal dependencies
import {getFakeModel, getAdapter} from '@MOCKS/Database'
import {getComponent} from '@MOCKS/Components'
import WalletStore from '@/store/Wallet'

// @ts-ignore
import WalletSelectorField from '@/components/WalletSelectorField/WalletSelectorField.vue'
import {WalletService} from '@/services/WalletService'
import {WalletModel} from '@/core/database/entities/WalletModel'

describe('components/WalletSelectorField', () => {
describe('getter for property "currentWalletIdentifier" should', () => {
Expand All @@ -41,9 +39,9 @@ describe('components/WalletSelectorField', () => {

test('return wallet identifier given value', () => {
// prepare
const wallet = getFakeModel('5678')
const wallet = {id: '5678'} as WalletModel
const wrapper = getComponent(WalletSelectorField, {wallet: WalletStore}, {}, {
value: wallet.getIdentifier(),
value: wallet.id,
})
const component = (wrapper.vm as WalletSelectorField)

Expand All @@ -68,20 +66,6 @@ describe('components/WalletSelectorField', () => {
expect(wrapper.vm.$store.dispatch).not.toHaveBeenCalled()
})

test('dispatch "notification/ADD_ERROR" given invalid identifier', () => {
// prepare
const wrapper = getComponent(WalletSelectorField, {wallet: WalletStore}, {})
const service = new WalletService(wrapper.vm.$store, getAdapter())
const component = (wrapper.vm as WalletSelectorField)
component.service = service

// act
component.currentWalletIdentifier = '1234' // wallet identifier does not exist
expect(component.$store.dispatch).toHaveBeenCalledWith(
'notification/ADD_ERROR',
'Wallet with identifier \'1234\' does not exist.',
)
})
})

describe('getter for property "currentWallets" should', () => {
Expand Down
160 changes: 0 additions & 160 deletions __tests__/database/BaseStorageAdapter.spec.ts

This file was deleted.

Loading

0 comments on commit f078610

Please sign in to comment.