Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthpun committed May 28, 2024
1 parent 465adfa commit b257b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion encoding/json/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ func (d *Decoder) decodeCapability(valueJSON any) cadence.Capability {
}
} else {
if _, hasKey := obj[pathKey]; hasKey {
panic("invalid capability: path is not supported")
panic(errors.NewDefaultUserError("invalid capability: path is not supported"))
}
}

Expand Down
22 changes: 5 additions & 17 deletions encoding/json/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2866,12 +2866,8 @@ func TestDecodeCapability(t *testing.T) {
t.Run("deprecated Path Capabliity without backwards compatability", func(t *testing.T) {

Check failure on line 2866 in encoding/json/encoding_test.go

View workflow job for this annotation

GitHub Actions / Lint

`compatability` is a misspelling of `compatibility` (misspell)

Check failure on line 2866 in encoding/json/encoding_test.go

View workflow job for this annotation

GitHub Actions / Lint

`compatability` is a misspelling of `compatibility` (misspell)
t.Parallel()

require.Panics(t, func() {

testDecode(
t,
// language=json
`
_, err := Decode(nil, []byte(
`
{
"type": "Capability",
"value": {
Expand All @@ -2889,18 +2885,10 @@ func TestDecodeCapability(t *testing.T) {
}
}
`,
cadence.NewDeprecatedPathCapability(
cadence.BytesToAddress([]byte{1, 2, 3, 4, 5}),
cadence.Path{
Domain: common.PathDomainPublic,
Identifier: "foo",
},
cadence.IntType,
),
)
})
})
))
require.Error(t, err)

})
}

func TestDecodeFixedPoints(t *testing.T) {
Expand Down

0 comments on commit b257b68

Please sign in to comment.