Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffledex committed Sep 13, 2021
1 parent 6708b67 commit eccfdfc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/Middleware.ts
Expand Up @@ -129,31 +129,32 @@ export class Middleware {
data: { transactionByHash: transaction },
} = result;

// TODO @shuffledex: remove commented lines once middleware team fix missing attributes
if (transaction) {
const {
block_id: blockNumber,
extrinsic_idx: extrinsicIdx,
address: rawAddress,
nonce,
// nonce,
module_id: moduleId,
call_id: callId,
params,
success: txSuccess,
spec_version_id: specVersionId,
extrinsic_hash: extrinsicHash,
// extrinsic_hash: extrinsicHash,
} = transaction;

return {
blockNumber: new BigNumber(blockNumber),
extrinsicIdx,
address: rawAddress ?? null,
/* eslint-disable @typescript-eslint/no-non-null-assertion */
nonce: nonce!,
nonce: 1, // nonce!,
txTag: extrinsicIdentifierToTxTag({ moduleId, callId }),
params,
success: !!txSuccess,
specVersionId,
extrinsicHash: extrinsicHash!,
extrinsicHash: '', // extrinsicHash!,
/* eslint-enable @typescript-eslint/no-non-null-assertion */
};
}
Expand Down
9 changes: 5 additions & 4 deletions src/__tests__/Middleware.ts
Expand Up @@ -145,6 +145,7 @@ describe('Middleware Class', () => {
const variable = { txHash: 'someHash' };

test('should return a transaction', async () => {
// TODO @shuffledex: remove commented lines once middleware team fix missing attributes
const blockNumber = new BigNumber(1);
const extrinsicIdx = 2;
const address = 'someAddress';
Expand Down Expand Up @@ -172,12 +173,12 @@ describe('Middleware Class', () => {
blockNumber,
extrinsicIdx: extrinsicIdx,
address,
nonce: undefined,
nonce: 1, // undefined,
txTag: 'asset.registerTicker',
params: [],
success: false,
specVersionId,
extrinsicHash: undefined,
extrinsicHash: '', // undefined,
});

dsMockUtils.createApolloQueryStub(transactionByHash({ transactionHash: variable.txHash }), {
Expand All @@ -200,12 +201,12 @@ describe('Middleware Class', () => {
blockNumber,
extrinsicIdx: extrinsicIdx,
address: null,
nonce: undefined,
nonce: 1, // undefined,
txTag: 'asset.registerTicker',
params: [],
success: false,
specVersionId,
extrinsicHash: undefined,
extrinsicHash: '', // undefined,
});
});

Expand Down
2 changes: 2 additions & 0 deletions src/api/entities/Sto/__tests__/index.ts
Expand Up @@ -279,6 +279,7 @@ describe('Sto class', () => {
const raiseToken = 'USD';
const offeringTokenAmount = new BigNumber(10000);
const raiseTokenAmount = new BigNumber(1000);
const datetime = '2020-10-10';

const items = [
{
Expand All @@ -287,6 +288,7 @@ describe('Sto class', () => {
raiseToken,
offeringTokenAmount: offeringTokenAmount.toNumber(),
raiseTokenAmount: raiseTokenAmount.toNumber(),
datetime,
},
];

Expand Down

0 comments on commit eccfdfc

Please sign in to comment.