Skip to content

Commit

Permalink
Redact 'setTopic'.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunxw committed Nov 21, 2023
1 parent c93eb9e commit 88013dd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
"@acala-network/chopsticks-testing": "^0.9.2",
"@polkadot/api": "^10.10.1",
"dotenv": "^16.3.1",
"lodash": "^4.17.21",
"typescript": "^5.2.2",
"vitest": "^0.34.4"
},
"devDependencies": {
"@types/lodash": "^4",
"@types/node": "^20.6.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/xcm-transfer/__snapshots__/kusama-para.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ exports[`'statemine' -> 'shiden' xcm transfer 'USDT' > xcmPallet transfer > from
},
},
{
"setTopic": "0xaef65e19edcf9abad8d23ee571d2fb6c40599abb429cced5fbd1a76706371c6c",
"setTopic": "redacted",
},
],
},
Expand Down
3 changes: 3 additions & 0 deletions tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ exports[`'statemint' -> 'astar' xcm transfer 'USDT' > xcmPallet transfer > from
},
},
},
{
"setTopic": "redacted",
},
],
},
],
Expand Down
8 changes: 7 additions & 1 deletion tests/xcm-transfer/shared.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash'

import { beforeEach, describe, it } from 'vitest'
import { sendTransaction } from '@acala-network/chopsticks-testing'

Expand Down Expand Up @@ -138,7 +140,11 @@ export default function buildTest(tests: ReadonlyArray<TestType>) {
if ('checkUmp' in testOpt) {
await checkUmp(fromChain).toMatchSnapshot('from chain ump messages')
} else {
await checkHrmp(fromChain).toMatchSnapshot('from chain hrmp messages')
await checkHrmp(fromChain)
.map((v) => JSON.parse(JSON.stringify(v)))
// redact setTopic
.map((v) => _.update(v, '[0].data[1].v3[4].setTopic', () => 'redacted'))
.toMatchSnapshot('from chain hrmp messages')
}

if (routeChain) {
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,13 @@ __metadata:
languageName: node
linkType: hard

"@types/lodash@npm:^4":
version: 4.14.202
resolution: "@types/lodash@npm:4.14.202"
checksum: a91acf3564a568c6f199912f3eb2c76c99c5a0d7e219394294213b3f2d54f672619f0fde4da22b29dc5d4c31457cd799acc2e5cb6bd90f9af04a1578483b6ff7
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:^20.6.0":
version: 20.8.9
resolution: "@types/node@npm:20.8.9"
Expand Down Expand Up @@ -2002,6 +2009,7 @@ __metadata:
"@acala-network/chopsticks": ^0.9.2
"@acala-network/chopsticks-testing": ^0.9.2
"@polkadot/api": ^10.10.1
"@types/lodash": ^4
"@types/node": ^20.6.0
"@typescript-eslint/eslint-plugin": ^6.7.3
"@typescript-eslint/parser": ^6.7.0
Expand All @@ -2014,6 +2022,7 @@ __metadata:
eslint-plugin-sort-imports-es6-autofix: ^0.6.0
husky: ^8.0.3
lint-staged: ^14.0.1
lodash: ^4.17.21
prettier: ^3.0.3
ts-node: ^10.9.1
typescript: ^5.2.2
Expand Down

0 comments on commit 88013dd

Please sign in to comment.