Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 429331b

Browse files
committed
Add test of "0" and "1" input as booleans
1 parent 25c705d commit 429331b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/encoder/test/bool.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,28 @@ describe("Encoding", () => {
165165
);
166166
});
167167

168+
it("Encodes '1' as true", async () => {
169+
const { data } = await encoder.encodeTxNoResolution(abi, ["1"], {
170+
strictBooleans: true
171+
});
172+
assert.strictEqual(
173+
data,
174+
selector +
175+
"0000000000000000000000000000000000000000000000000000000000000001"
176+
);
177+
});
178+
179+
it("Encodes '0' as false", async () => {
180+
const { data } = await encoder.encodeTxNoResolution(abi, ["0"], {
181+
strictBooleans: true
182+
});
183+
assert.strictEqual(
184+
data,
185+
selector +
186+
"0000000000000000000000000000000000000000000000000000000000000000"
187+
);
188+
});
189+
168190
it("Encodes boxed empty strings as false", async () => {
169191
const { data } = await encoder.encodeTxNoResolution(abi, [
170192
new String("")

0 commit comments

Comments
 (0)