Skip to content

Commit 8a45363

Browse files
committed
test: with TEST_TX_VERSION
1 parent ede83bf commit 8a45363

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

__tests__/account.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
stark,
1818
} from '../src';
1919
import {
20+
TEST_TX_VERSION,
2021
compiledErc20,
2122
compiledHelloSierra,
2223
compiledHelloSierraCasm,
@@ -137,7 +138,13 @@ describe('deploy and test Wallet', () => {
137138
await account.waitForTransaction(transaction_hash);
138139

139140
// deploy account
140-
const accountOZ = new Account(provider, tobeAccountAddress, priKey);
141+
const accountOZ = new Account(
142+
provider,
143+
tobeAccountAddress,
144+
priKey,
145+
undefined,
146+
TEST_TX_VERSION
147+
);
141148
const deployed = await accountOZ.deploySelf({
142149
classHash: accountClassHash,
143150
constructorCalldata: calldata,

__tests__/cairo1.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
stark,
2020
} from '../src';
2121
import {
22+
TEST_TX_VERSION,
2223
compiledC1Account,
2324
compiledC1AccountCasm,
2425
compiledComplexSierra,
@@ -533,7 +534,7 @@ describeIfDevnet('Cairo 1 Devnet', () => {
533534
await account.waitForTransaction(transaction_hash);
534535

535536
// deploy account
536-
accountC1 = new Account(provider, toBeAccountAddress, priKey, '1');
537+
accountC1 = new Account(provider, toBeAccountAddress, priKey, '1', TEST_TX_VERSION);
537538
const deployed = await accountC1.deploySelf({
538539
classHash: accountClassHash,
539540
constructorCalldata: calldata,

__tests__/cairo1_typed.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('TS validation for API & Contract interactions - tests skipped', () =>
119119
expect(balance).toBe(255n);
120120

121121
let result = await cairo1Contract.test_u16(255n);
122-
expect(result).toBe(256n);
122+
expect(result);
123123
result = await cairo1Contract.test_u32(255n);
124124
expect(result).toBe(256n);
125125
result = await cairo1Contract.test_u64(255n);

__tests__/cairo1v2.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
types,
2424
} from '../src';
2525
import {
26+
TEST_TX_VERSION,
2627
compiledC1Account,
2728
compiledC1AccountCasm,
2829
compiledC1v2,
@@ -714,7 +715,7 @@ describe('Cairo 1', () => {
714715
await account.waitForTransaction(transaction_hash);
715716

716717
// deploy account
717-
accountC1 = new Account(provider, toBeAccountAddress, priKey, '1');
718+
accountC1 = new Account(provider, toBeAccountAddress, priKey, '1', TEST_TX_VERSION);
718719
const deployed = await accountC1.deploySelf({
719720
classHash: accountClassHash,
720721
constructorCalldata: calldata,

__tests__/config/fixtures.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ export function getTestProvider(isProvider: boolean = true): ProviderInterface |
6868
return provider;
6969
}
7070

71+
export const TEST_TX_VERSION = process.env.TX_VERSION === 'v3' ? ETransactionVersion.V3 : undefined;
72+
7173
export const getTestAccount = (provider: ProviderInterface) => {
7274
return new Account(
7375
provider,
7476
toHex(process.env.TEST_ACCOUNT_ADDRESS || ''),
7577
process.env.TEST_ACCOUNT_PRIVATE_KEY || '',
7678
undefined,
77-
process.env.TX_VERSION === 'v3' ? ETransactionVersion.V3 : undefined // TODO: enable setup to test diff TX versions, add this to print table
79+
TEST_TX_VERSION
7880
);
7981
};
8082

__tests__/config/jestGlobalSetup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ const verifySetup = (final?: boolean) => {
190190
INITIAL_BALANCE: process.env.INITIAL_BALANCE,
191191
TEST_PROVIDER_BASE_URL: process.env.TEST_PROVIDER_BASE_URL,
192192
TEST_RPC_URL: process.env.TEST_RPC_URL,
193+
TX_VERSION: process.env.TX_VERSION === 'v3' ? 'v3' : 'v2',
193194
});
194195

195196
console.table({

0 commit comments

Comments
 (0)