Skip to content

Add test to assert default value of cooldown_period_seconds in config #9

@sourcery-ai

Description

@sourcery-ai

There is currently no test that asserts the default value of cooldown_period_seconds is set correctly when it is not provided in the configuration. This could lead to regressions if the default value changes or is not set as expected.

Suggested Action Items:

  1. Add a test to verify that the default value of cooldown_period_seconds is set when the field is omitted from the config.
  2. Implement a Cucumber step, for example:
    #[then(regex = r#"^cooldown_period_seconds is (\d+)$"#)]
    fn cooldown_period_seconds_is(world: &mut ConfigWorld, expected: u64) {
        match world.result.take() {
            Some(Ok(cfg)) => assert_eq!(cfg.cooldown_period_seconds, expected),
            other => panic!("expected success, got {other:?}"),
        }
    }
  3. Add a scenario to the Cucumber feature file that loads a config without specifying cooldown_period_seconds and then uses the step:
    Then cooldown_period_seconds is <DEFAULT_VALUE>
    
    Replace <DEFAULT_VALUE> with the actual default value from your config implementation.

This will ensure the default behavior is covered by tests and prevent future regressions.

Issue: #9


I created this issue for @leynos from #4 (comment).

Tips and commands

Getting Help

Metadata

Metadata

Assignees

No one assigned

    Labels

    lowAin't annoying anyone but the QA department

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions