Skip to content

Commit df3c30b

Browse files
committed
test
1 parent f6b64b0 commit df3c30b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

packages/thirdweb/src/utils/abi/normalizeFunctionParams.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe("normalizeFunctionParams", () => {
5656
});
5757

5858
it("should throw an error if a parameter name is missing", () => {
59-
const abiFunction: AbiFunction = {
59+
let abiFunction: AbiFunction = {
6060
inputs: [{ name: undefined, type: "uint256" }],
6161
type: "function",
6262
stateMutability: "pure",
@@ -67,6 +67,31 @@ describe("normalizeFunctionParams", () => {
6767
expect(() => normalizeFunctionParams(abiFunction, {})).toThrow(
6868
"Missing named parameter for test at index 0",
6969
);
70+
71+
abiFunction = {
72+
inputs: [{ name: "", type: "uint256" }],
73+
type: "function",
74+
stateMutability: "pure",
75+
name: "test",
76+
outputs: [],
77+
};
78+
79+
expect(() => normalizeFunctionParams(abiFunction, {})).toThrow(
80+
"Missing named parameter for test at index 0",
81+
);
82+
83+
abiFunction = {
84+
inputs: [{ name: undefined, type: "uint256" }],
85+
type: "function",
86+
stateMutability: "pure",
87+
name: "test",
88+
outputs: [],
89+
};
90+
91+
const normalied = normalizeFunctionParams(abiFunction, { "*": 123 });
92+
93+
expect(normalied.length).to.eq(1);
94+
expect(normalied[0]).to.eq(123);
7095
});
7196

7297
it("should throw an error if a parameter value is missing", () => {

0 commit comments

Comments
 (0)