Skip to content

Commit 525739d

Browse files
authored
Use asSnakeData for Timelock calls TS test + remove thin test util (#106)
* Use asSnakeData for Timelock calls TS test * Polish - remove thin util
1 parent 60d54e3 commit 525739d

File tree

22 files changed

+196
-195
lines changed

22 files changed

+196
-195
lines changed

contracts/tests/Logs.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,3 @@ export const testLog = (
2626
}
2727
return true
2828
}
29-
export const expectSuccessfulTransaction = (result: any, from: Address, to: Address) => {
30-
expect(result.transactions).toHaveTransaction({ from, to, success: true })
31-
}
32-
33-
export const expectFailedTransaction = (
34-
result: any,
35-
from: Address,
36-
to: Address,
37-
exitCode: number,
38-
) => {
39-
expect(result.transactions).toHaveTransaction({ from, to, exitCode, success: false })
40-
}

contracts/tests/ccip/CCIPRouter.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '../../wrappers/ccip/FeeQuoter'
1212
import { testLog, getExternals } from '../Logs'
1313
import '@ton/test-utils'
14-
import { ZERO_ADDRESS } from '../../utils/Utils'
14+
import { ZERO_ADDRESS } from '../../utils'
1515

1616
const CHAINSEL_EVM_TEST_90000001 = 909606746561742123n
1717
const CHAINSEL_TON = 13879075125137744094n

contracts/tests/ccip/OffRamp.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import {
1010
FeeQuoterStorage,
1111
TimestampedPrice,
1212
} from '../../wrappers/ccip/FeeQuoter'
13-
import { testLog, getExternals, expectSuccessfulTransaction } from '../Logs'
1413
import '@ton/test-utils'
15-
import { uint8ArrayToBigInt, ZERO_ADDRESS } from '../../utils/Utils'
14+
import { uint8ArrayToBigInt, ZERO_ADDRESS } from '../../utils'
1615
import { KeyPair } from '@ton/crypto'
1716
import { expectEqualsConfig, generateEd25519KeyPair } from '../libraries/ocr/Helpers'
1817
import {
@@ -141,7 +140,11 @@ describe('OffRamp', () => {
141140
deployer.getSender(),
142141
createDefaultConfig(),
143142
)
144-
expectSuccessfulTransaction(resultSetCommit, deployer.address, offRamp.address)
143+
expect(resultSetCommit.transactions).toHaveTransaction({
144+
from: deployer.address,
145+
to: offRamp.address,
146+
success: true,
147+
})
145148

146149
Logs.assertLog(
147150
resultSetCommit.transactions,
@@ -160,7 +163,11 @@ describe('OffRamp', () => {
160163
deployer.getSender(),
161164
createDefaultConfig({ ocrPluginType: OCR3_PLUGIN_TYPE_EXECUTE }),
162165
)
163-
expectSuccessfulTransaction(resultSetExecute, deployer.address, offRamp.address)
166+
expect(resultSetExecute.transactions).toHaveTransaction({
167+
from: deployer.address,
168+
to: offRamp.address,
169+
success: true,
170+
})
164171
Logs.assertLog(
165172
resultSetCommit.transactions,
166173
offRamp.address,

contracts/tests/ccip/helpers/SetUp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Blockchain, SandboxContract, TreasuryContract } from '@ton/sandbox'
2-
import { ZERO_ADDRESS } from '../../../utils/Utils'
2+
import { ZERO_ADDRESS } from '../../../utils'
33
import {
44
createTimestampedPriceValue,
55
FeeQuoter,

contracts/tests/lib/merkle_proof/helpers/MerkleMultiProofHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uint8ArrayToBigInt, bigIntToUint8Array } from '../../../../utils/Utils'
1+
import { uint8ArrayToBigInt, bigIntToUint8Array } from '../../../../utils'
22
import { beginCell } from '@ton/core'
33

44
// Internal domain separator for Merkle internal nodes, represented as a 256-bit BigInt (0x01)

contracts/tests/lib/merkle_proof/helpers/Utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Builder, beginCell, Cell } from '@ton/core'
2-
import { asSnakeData } from '../../../../utils/Utils'
2+
import { asSnakeData } from '../../../../utils'
33

44
export function listAsSnake(array: bigint[]): Cell {
55
return asSnakeData(array, (item) => new Builder().storeUint(item, 256))

contracts/tests/libraries/ocr/Helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Address, Message, toNano } from '@ton/core'
22
import { mnemonicNew, mnemonicToPrivateKey } from '@ton/crypto'
33
import { WalletContractV4 } from '@ton/ton'
44
import crypto from 'crypto'
5-
import { uint8ArrayToBigInt } from '../../../utils/Utils'
5+
import { uint8ArrayToBigInt } from '../../../utils'
66
import { OCR3_PLUGIN_TYPE_COMMIT, OCR3Config } from '../../../wrappers/libraries/ocr/MultiOCR3Base'
77
import { BlockchainTransaction } from '@ton/sandbox'
88
async function generateRandomTonAddress() {

contracts/tests/libraries/ocr/Logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
OCR3BaseTransmitted,
66
} from '../../../wrappers/libraries/ocr/Logs'
77
import { testLog, getExternals } from '../../Logs'
8-
import { fromSnakeData } from '../../../utils/Utils'
8+
import { fromSnakeData } from '../../../utils'
99
import { BlockchainTransaction } from '@ton/sandbox'
1010

1111
export const testConfigSetLogMessage = (

0 commit comments

Comments
 (0)