Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix setting abi and add tests #161

Merged
merged 8 commits into from
Jan 21, 2024
Prev Previous commit
Next Next commit
fix unit tests
  • Loading branch information
storywithoutend committed Jan 18, 2024
commit 483f0951012b695208902c7269fb51a5758cd78c
6 changes: 3 additions & 3 deletions packages/ensjs/src/utils/encoders/encodeSetAbi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { encodeSetAbi, type EncodeSetAbiParameters } from './encodeSetAbi.js'
describe('encodeSetAbi', () => {
const namehash =
'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
const contentType = 0
const encodedData = null
const contentType = 1
const encodedData = '0x'

const parameters: EncodeSetAbiParameters = {
namehash,
Expand All @@ -15,7 +15,7 @@ describe('encodeSetAbi', () => {

it('encodes the setAbi function data correctly', () => {
const expected =
'0x623195b01234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000'
'0x623195b01234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000'
const result = encodeSetAbi(parameters)
expect(result).toEqual(expected)
})
Expand Down
12 changes: 0 additions & 12 deletions packages/ensjs/src/utils/generateRecordCallArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ it('adds contentHash call when contentHash is defined', () => {
]
`)
})
it('adds abi call when abi is null', () => {
expect(
generateRecordCallArray({
namehash: namehash('test.eth'),
abi: null,
}),
).toMatchInlineSnapshot(`
[
"0x623195b0eb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
]
`)
})
it('does not add abi call when abi is undefined', () => {
expect(
generateRecordCallArray({
Expand Down
Loading