Skip to content

test_learn_token_zero_score_error_message tests submit_quiz_score instead of claim_reward #459

Description

@DeFiVC

What

The test test_learn_token_zero_score_error_message (line 360-381) expects #[should_panic(expected = "score must be greater than 0")] but calls pt_client.submit_quiz_score(...) with score 0. However, submit_quiz_score in progress-tracker accepts score 0 — it does NOT validate score > 0. The "score must be greater than 0" check exists only in learn-token's claim_reward (line 653-655). The test never calls claim_reward, so the expected panic never occurs.

Why

The test doesn't verify what its name claims. It passes for the wrong reason (or doesn't compile/run). There is no test that actually verifies claim_reward's behavior with score 0.

Scope

  • Fix the test to actually test claim_reward with a score of 0, which requires:
    1. Setting up a progress-tracker with a quiz submitted at score 0
    2. Calling claim_reward which should panic with "score must be greater than 0"
  • OR rename the test to accurately reflect what it tests

Acceptance Criteria

  • The test actually exercises the code path it claims to test
  • The test name matches the behavior being tested

Technical Context

  • tests/unit/error_message_tests.rs:360-381 — the test
  • contracts/progress-tracker/src/lib.rs:747-752 — submit_quiz_score accepts score 0
  • contracts/learn-token/src/lib.rs:653-655 — claim_reward rejects score 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programmediumFunctionality impaired but workaround exists, edge case, partial featurerustRust languagetestsTest additions or improvements

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions