From 2d440b3af69d239c201bc2ae33efee86a1a08a45 Mon Sep 17 00:00:00 2001 From: Gusarich Date: Tue, 26 Mar 2024 11:07:09 +0300 Subject: [PATCH] fix bug with ` symbol in error message --- src/bindings/writeTypescript.ts | 6 +++++- src/test/__snapshots__/bugs.spec.ts.snap | 8 ++++---- src/test/bugs.spec.ts | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bindings/writeTypescript.ts b/src/bindings/writeTypescript.ts index d4b56b74e..4715803e2 100644 --- a/src/bindings/writeTypescript.ts +++ b/src/bindings/writeTypescript.ts @@ -146,7 +146,11 @@ export function writeTypescript(abi: ContractABI, init?: { w.inIndent(() => { if (abi.errors) { for (const k in abi.errors) { - w.append(`${k}: { message: \`${abi.errors[parseInt(k, 10)].message}\` },`); + w.append( + `${k}: { message: \`${abi.errors[ + parseInt(k, 10) + ].message.replaceAll('`', '\\`')}\` },` + ); } } }); diff --git a/src/test/__snapshots__/bugs.spec.ts.snap b/src/test/__snapshots__/bugs.spec.ts.snap index 270ddcc2d..e9e1f7db2 100644 --- a/src/test/__snapshots__/bugs.spec.ts.snap +++ b/src/test/__snapshots__/bugs.spec.ts.snap @@ -12,12 +12,12 @@ exports[`bugs should deploy contract correctly 1`] = ` "$type": "received", "message": { "body": { - "cell": "x{178D45190000000000000000502540BE400801D98D6D0FE85B55D6D58229C8ED55470B1C744D6BEEAD475C27236E9908A993110016E3A425A4E75B646191AC9A34FE5D050BD101A5C490F87D01C66D885D09BC1082_}", + "cell": "x{178D45190000000000000000502540BE400800A8651ACEAB81220DBBF8AA566E0CBE7FC77A30EADF32B457F1CF4DE9575E5A210016E3A425A4E75B646191AC9A34FE5D050BD101A5C490F87D01C66D885D09BC1082_}", "type": "cell", }, "bounce": false, - "from": "kQDsxraH9C2q62rBFOR2qqOFjjomtfdWo64TkbdMhFTJiLsN", - "to": "kQBGSDIgoUMAjGBNBXjsdBRlfPtqK5rKgQOD5N7yKFfIXeuh", + "from": "kQBUMo1nVcCRBt38VSs3Bl8_470YdW-ZWiv456b0q68tEE5x", + "to": "kQCzGu8bropdv4KCT6jpaDeRXU1coEBo8pjeCjMAt-xYDAXm", "type": "internal", "value": "9.95885", }, @@ -38,7 +38,7 @@ exports[`bugs should deploy contract correctly 1`] = ` }, }, "bounce": false, - "from": "kQBGSDIgoUMAjGBNBXjsdBRlfPtqK5rKgQOD5N7yKFfIXeuh", + "from": "kQCzGu8bropdv4KCT6jpaDeRXU1coEBo8pjeCjMAt-xYDAXm", "to": "@treasure(treasure)", "type": "internal", "value": "9.914852826", diff --git a/src/test/bugs.spec.ts b/src/test/bugs.spec.ts index 9fc6ccfc9..972f390b4 100644 --- a/src/test/bugs.spec.ts +++ b/src/test/bugs.spec.ts @@ -19,6 +19,8 @@ describe('bugs', () => { await contract.send(treasure, { value: toNano('10') }, { $$type: 'Mint', receiver: treasure.address, amount: toNano('10') }); await system.run(); + expect(contract.abi.errors!['31733'].message).toStrictEqual('condition can`t be...') + expect(tracker.collect()).toMatchSnapshot(); }); }); \ No newline at end of file