aur-rs 0.1.1

Library for interacting with the Arch User Repository's RPC interface
Documentation
// Tests starts_with_name

use aur_rs::Request;
use httpmock::prelude::*;

mod common;

#[tokio::test]
async fn starts_with_test() {
    let kit = common::setup();

    let starts_with_mock = kit.mock_server.mock(|when, then| {
        when.method(GET).path("/rpc/v5/suggest/yay");
        then.status(200).body(kit.valid_suggest_json.clone());
    });

    let url = kit.mock_server.url("/rpc/v5");
    let request = Request {
        endpoint: url.to_string(),
    };

    let response = request.starts_with_name("yay").await.unwrap();

    starts_with_mock.assert();

    assert_eq!(response, vec!["yay", "yay-bin", "yay-git", "yayfzf"])
}