diff --git a/tests/__mocks__/formatErrorTestData.json b/tests/__mocks__/formatErrorTestData.json index 4bf6ec4..f50d23e 100644 --- a/tests/__mocks__/formatErrorTestData.json +++ b/tests/__mocks__/formatErrorTestData.json @@ -71,8 +71,5 @@ }, { "error": "RPC: starknet_estimateFee with params {\"request\":[{\"type\":\"DEPLOY_ACCOUNT\",\"constructor_calldata\":[\"0x5aa23d5bb71ddaa783da7ea79d405315bafa7cf0387a74f4593578c3e9e6570\",\"0x2dd76e7ad84dbed81c314ffe5e7a7cacfb8f4836f01af4e913f275f89a3de1a\",\"0x1\",\"0x61d065cb71c8f6bc96321236738d2eee6514fb1366bcd6b079a68954b8f950d\"],\"class_hash\":\"0x3131fa018d520a037686ce3efddeab8f28895662f019ca3ca18a626650f7d1e\",\"contract_address_salt\":\"0x61d065cb71c8f6bc96321236738d2eee6514fb1366bcd6b079a68954b8f950d\",\"version\":\"0x1\",\"signature\":[\"0x7a85fc999f52140113470cb0ed9aab1ae711553eacbc5857361a3fa86762c0\",\"0x52284fa74f3bae9eeb1eb1f54fc7abb4174982e874fc03cb9842db9b04c3085\",\"0x346585699fe7ad65b73c15f2a7ed6dacbe4404aacf2a719bf4e6368ca4da851\",\"0x0\",\"0x0\",\"0x0\",\"0x0\",\"0x0\",\"0x0\",\"0x0\"],\"nonce\":\"0x0\",\"max_fee\":\"0x0\"},{\"type\":\"INVOKE\",\"sender_address\":\"0x315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2\",\"calldata\":[\"0x1\",\"0x315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2\",\"0x3c0bc29c677336b90c8d4fbc4661abeefe142936f7f7f43778f21b23d514747\",\"0x0\",\"0x3\",\"0x3\",\"0x1\",\"0x2dc002de0c09aa502e250409ccaa226ae8b0548a316df31c9dbd23a6c68bdd1\",\"0x2\"],\"version\":\"0x100000000000000000000000000000001\",\"signature\":[\"0x48488f3c57c6b499160de65abadefb300867e781edef06680e0cb7281a55247\",\"0x6df0e3a375e2e707f9ee91fa214a363461b299b2207d6fad736ab9dda16f489\"],\"nonce\":\"0x1\",\"max_fee\":\"0x0\"}],\"block_id\":\"pending\"}\n 40: Contract error: {\"revert_error\":\"Execution error at transaction index 1: Error in the called contract (0x0315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2):\nError at pc=0:10:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:228)\nUnknown location (pc=0:214)\n\nError in the called contract (0x0315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2):\nError at pc=0:37:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:10459)\nUnknown location (pc=0:10400)\nUnknown location (pc=0:7188)\nUnknown location (pc=0:7209)\n\nError in the called contract (0x0315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2):\nError at pc=0:10:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:228)\nUnknown location (pc=0:214)\n\nError in the called contract (0x0315d1aece67d182ee4d52bcf0c2c122826461f03941f214d29ab2a2aa6c39a2):\nError at pc=0:133:\nGot an exception while executing a hint: Assertion failed, 0 <= ids.a % PRIME < range_check_builtin.bound \n a = 3618502788666131213697322783095070105623107215331596699973092056135872020480 is out of range\nCairo traceback (most recent call last):\nUnknown location (pc=0:9036)\nUnknown location (pc=0:9007)\nError message estimate fee: Oops: something is wrong\nUnknown location (pc=0:5120)\nUnknown location (pc=0:146)\nUnknown location (pc=0:139)\n\"}" - }, - { - "error": "RPC: starknet_estimateFee with params {\n \"request\": [\n {\n \"type\": \"INVOKE\",\n \"sender_address\": \"0x7685acf69d92a6c6ed2642abb3ca4d6f422ed4d797af6226e2ddbe8ab6efdb7\",\n \"calldata\": [\n \"0x2\",\n \"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n \"0x219209e083275171774dab1df80982e9df2096516f06319c5c6d71ae0a8480c\",\n \"0x3\",\n \"0x5d3623995d517d18fe7be56280a94706333e7d16638c30faf87b857573e0b6c\",\n \"0x9184e72a000\",\n \"0x0\",\n \"0x5d3623995d517d18fe7be56280a94706333e7d16638c30faf87b857573e0b6c\",\n \"0x3a04795accb4b73d12f13b05a1e0e240cefeb9a89d008676730867a819d2f79\",\n \"0x2\",\n \"0x9184e72a000\",\n \"0x0\"\n ],\n \"version\": \"0x100000000000000000000000000000001\",\n \"signature\": [\n \"0x1\",\n \"0x0\",\n \"0x0\"\n ],\n \"nonce\": \"0x5\",\n \"max_fee\": \"0x0\"\n }\n ],\n \"block_id\": \"pending\",\n \"simulation_flags\": [\n \"SKIP_VALIDATE\"\n ]\n}\n \n 41: Transaction execution error: {\"execution_error\":\"Error in the called contract (0x07685acf69d92a6c6ed2642abb3ca4d6f422ed4d797af6226e2ddbe8ab6efdb7):\nError at pc=0:20259:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:309)\nUnknown location (pc=0:5819)\nUnknown location (pc=0:11008)\nUnknown location (pc=0:20292)\n\nError in the called contract (0x05d3623995d517d18fe7be56280a94706333e7d16638c30faf87b857573e0b6c):\nError at pc=0:10:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:313)\nUnknown location (pc=0:299)\n\nError in the called contract (0x05d3623995d517d18fe7be56280a94706333e7d16638c30faf87b857573e0b6c):\nError at pc=0:3225:\nError message: Oops: something else went completely wrong\n\nCairo traceback (most recent call last):\nUnknown location (pc=0:4938)\nUnknown location (pc=0:4917)\n\",\"transaction_index\":0}" } ] diff --git a/tests/__mocks__/repository/errors-default.json b/tests/__mocks__/repository/errors-default.json index ed4bb90..4ffb038 100644 --- a/tests/__mocks__/repository/errors-default.json +++ b/tests/__mocks__/repository/errors-default.json @@ -17,15 +17,6 @@ "matcher": "/Error message estimate fee: ([^\\\\\\n]*)/" } ] - }, - { - "matcher": "/Error message: [^\\\\\\n]*/", - "message": "Error message: {{0}}", - "extractors": [ - { - "matcher": "/Error message: ([^\\\\\\n]*)/" - } - ] } ] } diff --git a/tests/index.test.ts b/tests/index.test.ts index 03daa52..5f86fe1 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -200,14 +200,6 @@ describe("formatError", () => { result: "Error message: Oops: something is wrong", }); }); - - it("if the message is from rpc and has 3 lines", () => { - expect(formatError(formatErrorTestData[11])).toEqual({ - protocol: undefined, - interface: undefined, - result: "Error message: Oops: something else went completely wrong", - }); - }); }); describe("should return an unprocessed message if the error message doesn't match any matcher", () => {