Skip to content

Comments

Test/savings goals lock unlock#110

Open
NueloSE wants to merge 5 commits intoRemitwise-Org:mainfrom
NueloSE:test/savings-goals-lock-unlock
Open

Test/savings goals lock unlock#110
NueloSE wants to merge 5 commits intoRemitwise-Org:mainfrom
NueloSE:test/savings-goals-lock-unlock

Conversation

@NueloSE
Copy link

@NueloSE NueloSE commented Feb 19, 2026

Description

This PR implements missing test coverage for the lock_goaland unlock_goal functionality in the Savings Goals contract. It ensures that locking restricts withdrawals and that only the owner can perform these actions.

Additionally, this PR fixes a critical bug in the add_to_goal function where duplicate logic caused ambiguity, and resolves compilation errors in lib.rs (duplicate imports, moved values).

Changes

  • Added 7 new test cases to src/test.rs covering:
    • Successful locking and unlocking by owner.
    • Panic on unauthorized access (non-owner).
    • Withdrawal failure when goal is locked.
    • Withdrawal success after unlocking.
  • Restored and fixed legacy event emission tests in src/test.rs.
  • Fixed add_to_goal implementation in lib.rsto remove duplicate logic and handle errors correctly.
  • Cleaned up lib.rs imports and removed broken inline tests.

Verification

  • Run cargo test in savings_goals directory.
  • All 37 tests passed.
saving-goal screenshot

close #62

@Baskarayelu
Copy link
Contributor

@NueloSE fix the pipeline

@NueloSE NueloSE marked this pull request as draft February 20, 2026 11:54
@NueloSE NueloSE marked this pull request as ready for review February 20, 2026 12:09
@Baskarayelu
Copy link
Contributor

@NueloSE please fix the pipeline

@NueloSE
Copy link
Author

NueloSE commented Feb 21, 2026

@Baskarayelu kindly check fixed the pipeline issue now and resolved conflict

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.

Add Tests for Savings Goals lock_goal and unlock_goal

2 participants