Skip to content

Commit

Permalink
Fixes getTransactionHistory.js and Identity.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
markin-io committed Mar 1, 2022
1 parent eb6ee75 commit 3ba7213
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const BalanceIsNotEnoughError = require('@dashevo/dpp/lib/errors/consensus/fee/B
const DAPIClient = require('@dashevo/dapi-client/lib/DAPIClient');
const { hash } = require('@dashevo/dpp/lib/util/hash');
const Identifier = require('@dashevo/dpp/lib/identifier/Identifier');
const Transaction = require('@dashevo/dashcore-lib/lib/transaction');
const createClientWithFundedWallet = require('../../../lib/test/createClientWithFundedWallet');
const wait = require('../../../lib/wait');
const getDAPISeeds = require('../../../lib/test/getDAPISeeds');
const Transaction = require('@dashevo/dashcore-lib/lib/transaction');

describe('Platform', () => {
describe('Identity', () => {
Expand Down Expand Up @@ -114,11 +114,12 @@ describe('Platform', () => {
await wait(5000);
}

walletAccount.storage.insertIdentityIdAtIndex(
walletAccount.walletId,
identityOne.getId().toString(),
identityOneIndex,
);
walletAccount.storage
.getWalletStore(walletAccount.walletId)
.insertIdentityIdAtIndex(
identityOne.getId().toString(),
identityOneIndex,
);

// Creating transition that tries to spend the same transaction
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ function getTransactionHistory() {
network,
} = this;

const transactionsWithMetadata = this.getTransactions();
const transactions = this.getTransactions();

const walletStore = storage.getWalletStore(walletId);
const chainStore = storage.getChainStore(network);

const transactionsWithMetadata = Object.keys(transactions).reduce((acc, hash) => {
const { metadata } = chainStore.getTransaction(hash);
acc.push([transactions[hash], metadata]);
return acc;
}, []);

const { blockHeaders } = chainStore.state;

const categorizedTransactions = categorizeTransactions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ mockedHDSelf.getTransactions = getTransactions;
describe('Account - getTransactions', function suite() {
this.timeout(10000);
it('should get the transactions', () => {
const transactionsWithMetadata = getTransactions.call(mockedHDSelf);
const transactionsHash = transactionsWithMetadata.reduce((acc, el)=>{
acc.push(el[0].hash);
return acc;
},[]);
const transactions = getTransactions.call(mockedHDSelf);
const transactionsHash = Object.keys(transactions);

expect(transactionsHash).to.deep.equal([
'a43845e580ad01f31bc06ce47ab39674e40316c4c6b765b6e54d6d35777ef456',
Expand Down

0 comments on commit 3ba7213

Please sign in to comment.