Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.2 KB
Raw Blame
use super::{PaidPlan, StripePrices};
use teams::domain::model::CustomerError;

fn prices() -> StripePrices {
    StripePrices {
        premium: "price_premium".to_string(),
        max: Some("price_max".to_string()),
    }
}

#[test]
fn every_purchasable_plan_resolves_to_its_configured_price() {
    assert_eq!(
        prices().seat_prices().price_id(PaidPlan::Premium).unwrap(),
        "price_premium"
    );
    assert_eq!(
        prices().seat_prices().price_id(PaidPlan::Max).unwrap(),
        "price_max"
    );
}

#[test]
fn max_is_unavailable_until_its_price_is_configured() {
    let prices = StripePrices {
        premium: "price_premium".to_string(),
        max: None,
    };
    assert!(matches!(
        prices.seat_prices().price_id(PaidPlan::Max),
        Err(CustomerError::PlanUnavailable(PaidPlan::Max))
    ));
    assert_eq!(
        prices.seat_prices().price_id(PaidPlan::Premium).unwrap(),
        "price_premium"
    );
}

#[test]
fn configured_prices_are_recognized_by_plan() {
    assert_eq!(
        prices().plan_for_price("price_premium"),
        Some(PaidPlan::Premium)
    );
    assert_eq!(prices().plan_for_price("price_max"), Some(PaidPlan::Max));
    assert_eq!(prices().plan_for_price("price_other"), None);
}