Skip to content

no test coverage for required parameters #7

Closed

Description

@nothingmuch

The following test does not actually utilize required parameters, it just checks that non-required parameters are omitted if not required, so it should probably be renamed, and a new test should be introduced that actually checks that parameters with req- prefix are mandatory and that they can be parsed correctly when required.

bitcoin_uri/src/lib.rs

Lines 423 to 433 in 9362fab

#[test]
fn required_understood() {
let input = "bitcoin:1andreas3batLhQa2FawWjeyjCqyBzypd?somethingyoudontunderstand=50&somethingelseyoudontget=999";
let uri = input.parse::<Uri<'_, _>>().unwrap().require_network(bitcoin::Network::Bitcoin).unwrap();
assert_eq!(uri.address.to_string(), "1andreas3batLhQa2FawWjeyjCqyBzypd");
assert!(uri.amount.is_none());
assert!(uri.label.is_none());
assert!(uri.message.is_none());
assert_eq!(uri.to_string(), "bitcoin:1andreas3batLhQa2FawWjeyjCqyBzypd");
}

See payjoin/rust-payjoin#433 for related discussion

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions