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

Add some helpers functions for testing purposes. #435

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

smallhive
Copy link
Contributor

No description provided.

contracts/deploys.go Outdated Show resolved Hide resolved
contracts/deploys.go Outdated Show resolved Hide resolved
@smallhive smallhive force-pushed the contracts-tests-helpers branch 2 times, most recently from e016227 to ded2737 Compare September 23, 2024 05:00
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helpers should be tested themselves, especially with current implementation

tests/deploys.go Outdated Show resolved Hide resolved
tests/deploys.go Outdated Show resolved Hide resolved
tests/deploys.go Outdated Show resolved Hide resolved
@smallhive
Copy link
Contributor Author

helpers should be tested themselves, especially with current implementation

I added tests

tests/deploys_test.go Outdated Show resolved Hide resolved
tests/deploys_test.go Outdated Show resolved Hide resolved
tests/deploys_test.go Outdated Show resolved Hide resolved
cthulhu-rider
cthulhu-rider previously approved these changes Sep 23, 2024
Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, isn't most of the code can (should) be reused from rpc/nns package? It seems like it was made for it but mb I don't know some interfaces mismatch.

tests/deploys.go Outdated Show resolved Hide resolved
tests/deploys.go Outdated
}

func nnsContractInvoker(t *testing.T, e *neotest.Executor) *neotest.ContractInvoker {
nnsHash, err := e.Chain.GetContractScriptHash(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think @roman-khimov prefers

func InferHash(sg ContractStateGetter) (util.Uint160, error) {
or at least const from this package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do I, but I have nothing to suggest as a ContractStateGetter for InferHash func.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nns.ID is still relevant here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing to suggest as a ContractStateGetter for InferHash func

wasnt e.Chain good enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, neotest Chain is not good enough

tests/deploys.go Outdated Show resolved Hide resolved
tests/deploys.go Outdated Show resolved Hide resolved
tests/deploys.go Outdated
}

func nnsContractInvoker(t *testing.T, e *neotest.Executor) *neotest.ContractInvoker {
nnsHash, err := e.Chain.GetContractScriptHash(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nns.ID is still relevant here.

tests/deploys.go Outdated Show resolved Hide resolved
@roman-khimov roman-khimov merged commit a8d5e00 into master Sep 24, 2024
8 checks passed
@roman-khimov roman-khimov deleted the contracts-tests-helpers branch September 24, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants