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

chore: add full abi coder tests #3349

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Oct 21, 2024

Summary

  • We've added a feature complete contract (abi-contract) that taking in fixed inputs, and returns an expected value.
    • We did as @nedsalk mentioned that Sway does some precompiling.
  • We have added tests for each of the functions of the contract, currently using our current encoding package @fuel-ts/abi-coder.
    • This will allow us to switch out the Interface for our new refactored package with absolute certainty of no regression.
  • I have added a new custom vitest matcher toEqualBn to make it easier to check returned BN values.

Couple issues

  • For the custom vitest matchers, I struggled to get this working with TS so have added a TS ignore (// @ts-expect-error: Custom matcher 'toEqualBn') for now.
  • I was getting some odd results from some functions whereby the inputs we're being returned as the outputs. These are marked as (Most of these are suffering from the similar issue around returning the input as the output.)

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Comment on lines +107 to +108
// propC4: Vec<StructD<u16, u16, StructF<bool>>>,
// propC5: Vec<StructD<u32, u32, StructF<Vec<StructG>>>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should uncomment these and alter tests accordingly.

expect(value).toEqual(expected);
});
});
describe.todo('types_struct_with_multiple_struct_params', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo

.call();

const { value } = await waitForResult();
// expect(value).toEqual(expected);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing expect

Comment on lines 750 to 753
describe.todo('types_struct_with_vector');
describe.todo('types_struct_with_array_of_enums');
describe.todo('types_struct_with_complex_nested_struct');
describe.todo('types_struct_with_single_option');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants