Skip to content

Commit

Permalink
fix: test evm (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
phamphong9981 authored Aug 30, 2024
1 parent 75db615 commit e14d826
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/unit/services/erc721/erc721.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class Erc721Test {
evmTx = EVMTransaction.fromJson({
id: 11111,
hash: '',
height: 111,
height: this.evmSmartContract.created_height,
tx_msg_id: 222,
tx_id: 223,
contract_address: '',
Expand Down
8 changes: 4 additions & 4 deletions test/unit/services/erc721/erc721_handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ export default class Erc721HandlerTest {
];
await EvmEvent.query().insert(erc721Events).transacting(trx);
const erc721Activities = await Erc721Handler.getErc721Activities(
21937979,
21937985,
this.evmTx.height - 1,
this.evmTx.height,
this.broker.logger,
undefined,
trx
Expand Down Expand Up @@ -195,8 +195,8 @@ export default class Erc721HandlerTest {
});
const erc721ActivitiesByContract =
await Erc721Handler.getErc721Activities(
21937979,
21937985,
this.evmTx.height - 1,
this.evmTx.height,
this.broker.logger,
[this.evmSmartContract2.address],
trx
Expand Down
8 changes: 8 additions & 0 deletions test/unit/services/evm/crawl_contract_evm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import knex from '../../../../src/common/utils/db_connection';
import {
BlockCheckpoint,
EVMSmartContract,
EVMTransaction,
EvmInternalTransaction,
} from '../../../../src/models';

Expand Down Expand Up @@ -69,6 +70,13 @@ export default class CrawlContractEvmTest {
height: evmSmartContract.created_height,
}),
];
const mockTxQuery: any = {
select: () => mockTxQuery,
limit: () => ({ id: 1 }),
findOne: () => mockTxQuery,
orderBy: () => mockTxQuery,
};
jest.spyOn(EVMTransaction, 'query').mockImplementation(() => mockTxQuery);
const mockSelfDestructQuery: any = {
select: () => mockSelfDestructQuery,
joinRelated: () => mockSelfDestructQuery,
Expand Down

0 comments on commit e14d826

Please sign in to comment.