UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

3 lines (2 loc) 1.4 kB
"use strict";import{a as s}from"../../../../../__chunks__/chunk-BNOXD7GM.js";import{a as r}from"../../../../../__chunks__/chunk-RHY3XG6T.js";import{i as m}from"../../../../../__chunks__/chunk-7QE2X3X4.js";import{a as e,b as o,m as i}from"../../../../../__chunks__/chunk-HBP5N4FR.js";i();m();describe("getTransactionMethod",()=>{it('returns default value "Transaction" in case of missing "action" field ',()=>{let t=o(e({},s),{action:void 0}),n=r(t);expect(n).toEqual("Transaction")}),it(`returns default value "Transaction" when the transaction is a "${"transfer"}" and the action's category is "${"esdtNft"}"`,()=>{let t=o(e({},s),{action:{category:"esdtNft",name:"transfer"}}),n=r(t);expect(n).toEqual("Transaction")}),it(`returns the transaction method read from the action field when the transaction is not a "${"transfer"}" or the action's category is not "${"esdtNft"}"`,()=>{var a;let t=o(e({},s),{action:{category:"scCall",name:"claimRewards"}}),n=r(t);expect(n).toEqual((a=t.action)==null?void 0:a.name)}),it("overrides the transaction method when there is a transaction method defined on the action arguments",()=>{var a,c;let t=o(e({},s),{action:{category:"scCall",name:"claimRewards",arguments:{functionName:"customFunction"}}}),n=r(t);expect(n).toEqual((c=(a=t.action)==null?void 0:a.arguments)==null?void 0:c.functionName)})}); //# sourceMappingURL=getTransactionMethod.test.js.map