@@ -925,14 +925,25 @@ describe("interactions - sendTransaction", () => {
925
925
const signers = [Alice]
926
926
const args = [" Hello, Cadence" ]
927
927
928
- const [txResult , error ] = await shallRevert (
928
+ // Catch any cadence error
929
+ let [txResult, error] = await shallRevert (
929
930
sendTransaction ({
930
931
code,
931
932
signers,
932
933
args,
933
934
})
934
935
)
935
936
937
+ // Catch only specific panic message
938
+ let [txResult, error] = await shallRevert (
939
+ sendTransaction ({
940
+ code,
941
+ signers,
942
+ args,
943
+ }),
944
+ " You shall not pass!"
945
+ )
946
+
936
947
// Transaction result will hold status, events and error message
937
948
console .log ({txResult}, {error})
938
949
})
@@ -1053,8 +1064,8 @@ const main = async () => {
1053
1064
`
1054
1065
const args = [" Hello, from Cadence" ]
1055
1066
1056
- const [result , error ] = await executeScript ({code, args})
1057
- console .log ({result}, {error})
1067
+ const [result , error , logs ] = await executeScript ({code, args})
1068
+ console .log ({result}, {error}, {logs} )
1058
1069
1059
1070
// Stop emulator instance
1060
1071
await emulator .stop ()
@@ -1099,8 +1110,8 @@ const main = async () => {
1099
1110
const args = [" Hello, from Cadence" ]
1100
1111
1101
1112
// We assume there is a file `scripts/log-message.cdc` under base path
1102
- const [result , error ] = await executeScript (" log-message" , args)
1103
- console .log ({result}, {error})
1113
+ const [result , error , logs ] = await executeScript (" log-message" , args)
1114
+ console .log ({result}, {error}, {logs} )
1104
1115
1105
1116
await emulator .stop ()
1106
1117
}
@@ -1171,8 +1182,8 @@ const main = async () => {
1171
1182
const Alice = await getAccountAddress (" Alice" )
1172
1183
const signers = [Alice]
1173
1184
1174
- const [result , error ] = await sendTransaction ({code, args, signers})
1175
- console .log ({result}, {error})
1185
+ const [result , error , logs ] = await sendTransaction ({code, args, signers})
1186
+ console .log ({result}, {error}, {logs} )
1176
1187
1177
1188
// Stop emulator instance
1178
1189
await emulator .stop ()
@@ -1214,10 +1225,10 @@ const main = async () => {
1214
1225
// Define arguments we want to pass
1215
1226
const args = [" Hello, Cadence" ]
1216
1227
1217
- const [result , error ] = await shallPass (
1228
+ const [result , error , logs ] = await shallPass (
1218
1229
sendTransaction (" log-message" , [], args)
1219
1230
)
1220
- console .log ({result}, {error})
1231
+ console .log ({result}, {error}, {logs} )
1221
1232
1222
1233
// Stop the emulator instance
1223
1234
await emulator .stop ()
0 commit comments