NethermindEth / StarknetByExample

A collection of examples of Cairo smart contracts for Starknet.
https://starknet-by-example.voyager.online/
MIT License
101 stars 77 forks source link

test: countable (switchable, ownable) components #205

Closed NueloSE closed 1 week ago

NueloSE commented 1 month ago

Issue(s): #70

Description

Please provide a brief description of the changes made in this pull request and how they address the related issue.

Checklist

NueloSE commented 1 month ago

@julio4 ready for review

NueloSE commented 1 month ago

@julio4 ready for review

julio4 commented 3 weeks ago

@NueloSE Do you need any help to finish this?

NueloSE commented 3 weeks ago

@julio4 Yes I need help I haven't been able to figure how to add test to test emitted events for switchable and ownable

julio4 commented 3 weeks ago

@julio4 Yes I need help I haven't been able to figure how to add test to test emitted events for switchable and ownable

Read the tests of this section. (Be sure to toggle hidden lines)

NueloSE commented 2 weeks ago

Hi @julio4

misicnenad commented 2 weeks ago

Hi @julio4

  • I have added the ANCHOR tags
  • Implemented the test for emitted events in the reference sample but the test keeps failing for the emitted events. A screenshot has been attached of the error Screenshot from 2024-06-19 10-43-37

@julio4 I tested this locally and I experienced the same issues. It's like events are not being emitted from components.

@NueloSE could you try updating your tests to use Foundry (see Testing Smart Contracts)? Maybe these are some issues that they solved.

I tested this out with Foundry too, and found that there's a bug when spying on events emitted from components. Created a ticket for this to be investigated further, see https://github.com/starkware-libs/cairo/issues/5861.

julio4 commented 2 weeks ago

I tested this out with Foundry too, and found that there's a bug when spying on events emitted from components. Created a ticket for this to be investigated further, see starkware-libs/cairo#5861.

Good find, we can just comment the event spying for now.

NueloSE commented 1 week ago

Ready for Review

NueloSE commented 1 week ago

lgtm