Skip to content

Add tests for updateScarbProject async/await behavior #642

@coderabbitai

Description

@coderabbitai

Description

Add comprehensive tests for the updateScarbProject function in both Cairo and Cairo Alpha packages to verify proper async/await behavior and prevent race conditions.

Background

The updateScarbProject function was recently fixed in #640 to properly await asynchronous operations (writeLibCairo and updateScarbToml). Previously, these functions were called without await, causing race conditions.

Requirements

The tests should:

  1. Verify that writeLibCairo is properly awaited before updateScarbToml runs
  2. Ensure sequential execution prevents race conditions
  3. Test error handling when writeLibCairo fails
  4. Verify that updateScarbToml doesn't run if writeLibCairo fails
  5. For cairo_alpha: ensure the git/tag format for OpenZeppelin dependency is maintained

Files to add:

  • packages/core/cairo/src/scripts/update-scarb-project.test.ts
  • packages/core/cairo_alpha/src/scripts/update-scarb-project.test.ts

Related

Acceptance Criteria

  • Tests verify writeLibCairo is awaited
  • Tests verify sequential execution order
  • Tests handle error scenarios appropriately
  • Tests follow project's Ava testing conventions
  • All tests pass and provide good coverage of the async behavior

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions