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

Property Tests: Candid types #1390

Open
32 of 44 tasks
Tracked by #108
lastmjs opened this issue Oct 19, 2023 · 0 comments
Open
32 of 44 tasks
Tracked by #108

Property Tests: Candid types #1390

lastmjs opened this issue Oct 19, 2023 · 0 comments

Comments

@lastmjs
Copy link
Member

lastmjs commented Oct 19, 2023

  • principal
  • record
  • variant
  • tuple
  • func
  • service @dansteren
  • empty (skipping for now)
  • reserved (skipping for now)
  • float32 #1406
  • blob
  • bool
  • float64
  • int
  • int8
  • int16
  • int32
  • int64
  • nat #1401
  • nat8
  • nat16
  • nat32
  • nat64
  • null
  • opt
  • text
  • vec #1403
  • Update all <X>TestArbs so that they have a third item in the tuple, the return type, and have the arb generate a default value for a return type, rather than us hard-coding one into the test. Note: this should handle recursion and will need to convert a JS value back into the source code that creates the value... very tricky.
  • Update the tests to use src.valueLiteral instead of hard-coded tests. Make sure to add valueLiterals to arbs where needed like in variant_arb.ts
  • We need to do a pass to change returnType.values to returnType.src.valueLiteral. The values work for these primitives, but the code isn't saying what we're intending. So let's just do a pass.
  • Update the Opt tests to test the Some and None helper function/constant from Azle
  • Fix that one failing test from the PR. You'll have to go look through the Actions for https://github.com/demergent-labs/azle/actions/runs/6737893867/job/18316345422
  • Consider making the equality functions on our arbs something that returns a Result so that if our tests fail then we'll see exactly where the two objects weren't equal. Not doing in favor of using a global equals function or an equality assertion in the testing framework.

  • Consider aggregating all the params into a big list and then generating a query method for each of those that just takes in the one param and returns it. The goal being to have more test-coverage on the encoding of values.
  • Consider separating the arity of the tests from the arity of the canister methods. We may want to create more tests for each function, or vice-versa. So, we should make this more flexible.
  • Make a common wrapper function that wraps fast-equals and does checks for Principals and other non-compatible types. That way we just have one common function. This may be a little tricky.
  • Add an equals assertion to the testing framework that will print out the two values, maybe a nice diff. Once this is complete then you can remove the custom equality checking in record and tuple. @bdemann
  • All the arbs are very similar. See if we can combine them into some common function or something rather than repeating all this code.
  • Handle JS Keywords correctly. This may require updating JsFunctionName or making a new generator. Consider the different levels where each type of keyword is valid/invalid.
  • Figure out what's going on with Vec(Null). #1453
  • Update the VoidArb to sometimes return undefined and sometimes literally nothing.
  • Consider adding all opt params in opt test into a big record that we then wrap in opt and return
    • Is that really testing all opt return types or just opt(record)?
    • Are we even going to be able to construct a return candid type for that?
  • Understand the root cause of the principal problem #1443
@lastmjs lastmjs mentioned this issue Oct 19, 2023
17 tasks
@lastmjs lastmjs changed the title Candid types property tests Property Tests: Candid types Oct 19, 2023
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

No branches or pull requests

1 participant