Skip to content

Commit

Permalink
fix: contract test status
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Aug 8, 2023
1 parent c6ae7bd commit 53cfaf9
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions __tests__/contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { BigNumberish, Contract, ContractFactory, RawArgs, json, stark } from '../src';
import {
BigNumberish,
Contract,
ContractFactory,
RawArgs,
SuccessfulTransactionReceiptResponse,
json,
stark,
} from '../src';
import { CallData } from '../src/utils/calldata';
import { felt, isCairo1Abi, tuple, uint256 } from '../src/utils/calldata/cairo';
import { getSelectorFromName } from '../src/utils/hash';
Expand Down Expand Up @@ -646,8 +654,7 @@ describe('Complex interaction', () => {
test('invoke compiled data', async () => {
const result = await erc20Echo20Contract.iecho(CallData.compile(request));
const transaction = await provider.waitForTransaction(result.transaction_hash);

expect(transaction.status).toBeDefined();
expect((transaction as SuccessfulTransactionReceiptResponse).execution_status).toBeDefined();
});

// skip on live for performance
Expand All @@ -657,19 +664,19 @@ describe('Complex interaction', () => {

const result = await erc20Echo20Contract.iecho(calldata);
const transaction = await provider.waitForTransaction(result.transaction_hash);
expect(transaction.status).toBeDefined();
expect((transaction as SuccessfulTransactionReceiptResponse).execution_status).toBeDefined();

const result1 = await erc20Echo20Contract.iecho(...args);
const transaction1 = await provider.waitForTransaction(result1.transaction_hash);
expect(transaction1.status).toBeDefined();
expect((transaction1 as SuccessfulTransactionReceiptResponse).execution_status).toBeDefined();

const result2 = await erc20Echo20Contract.invoke('iecho', calldata);
const transaction2 = await provider.waitForTransaction(result2.transaction_hash);
expect(transaction2.status).toBeDefined();
expect((transaction2 as SuccessfulTransactionReceiptResponse).execution_status).toBeDefined();

const result3 = await erc20Echo20Contract.invoke('iecho', args);
const transaction3 = await provider.waitForTransaction(result3.transaction_hash);
expect(transaction3.status).toBeDefined();
expect((transaction3 as SuccessfulTransactionReceiptResponse).execution_status).toBeDefined();
});

describe('speedup live tests', () => {
Expand Down Expand Up @@ -722,7 +729,9 @@ describe('Complex interaction', () => {
{ formatResponse }
);
const transaction = await provider.waitForTransaction(result.transaction_hash);
expect(transaction.status).toBeDefined();
expect(
(transaction as SuccessfulTransactionReceiptResponse).execution_status
).toBeDefined();
});
});

Expand Down

0 comments on commit 53cfaf9

Please sign in to comment.