Skip to content

Commit

Permalink
Fixed TestClassAt at mock environment
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodeev committed May 24, 2024
1 parent dd98a9b commit e9fe044
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions rpc/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func TestClassAt(t *testing.T) {

require.Condition(func() bool {
for _, deprecatedCairoEntryPoint := range class.DeprecatedEntryPointsByType.External {
t.Log(deprecatedCairoEntryPoint)
if test.ExpectedOperation == deprecatedCairoEntryPoint.Selector.String() {
return true
}
Expand All @@ -104,7 +103,6 @@ func TestClassAt(t *testing.T) {

require.Condition(func() bool {
for _, entryPointsByType := range class.EntryPointsByType.External {
t.Log(entryPointsByType)
if test.ExpectedOperation == entryPointsByType.Selector.String() {
return true
}
Expand Down
14 changes: 14 additions & 0 deletions rpc/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,22 @@ func mock_starknet_getClassAt(result interface{}, method string, args ...interfa
if len(args) != 2 {
return errWrongArgs
}
fakeSelector, err := utils.HexToFelt("0xdeadbeef")
if err != nil {
return err
}
var class = DeprecatedContractClass{
Program: "H4sIAAAAAAAE/+Vde3PbOJL/Kj5VXW1mVqsC36Sr9g8n0c6mzonnbM",
DeprecatedEntryPointsByType: DeprecatedEntryPointsByType{
Constructor: []DeprecatedCairoEntryPoint{},
External: []DeprecatedCairoEntryPoint{
{
Offset: "0x0xdeadbeef",
Selector: fakeSelector,
},
},
L1Handler: []DeprecatedCairoEntryPoint{},
},
}
outputContent, err := json.Marshal(class)
if err != nil {
Expand Down

0 comments on commit e9fe044

Please sign in to comment.