|
| 1 | +//! Basic tests to ensure that the plan interval types |
| 2 | +//! are exported properly. Mainly just needs to compile. |
| 3 | +
|
| 4 | +mod mock; |
| 5 | + |
| 6 | +#[test] |
| 7 | +#[cfg(feature = "blocking")] |
| 8 | +fn can_create_plan() { |
| 9 | + let id = "price_123".parse().unwrap(); |
| 10 | + mock::with_client(|client| { |
| 11 | + let mut plan = stripe::Plan::retrieve(client, &id, &[]).unwrap(); |
| 12 | + plan.interval = Some(stripe::PlanInterval::Month); |
| 13 | + }); |
| 14 | +} |
| 15 | + |
| 16 | +#[test] |
| 17 | +#[cfg(feature = "blocking")] |
| 18 | +fn can_create_subscription_interval() { |
| 19 | + let recurring = stripe::SubscriptionPriceDataRecurring { |
| 20 | + interval: stripe::SubscriptionInterval::Month, |
| 21 | + interval_count: Some(100), |
| 22 | + }; |
| 23 | +} |
| 24 | + |
| 25 | +#[test] |
| 26 | +#[cfg(feature = "blocking")] |
| 27 | +fn can_create_subscription_plan_interval() { |
| 28 | + mock::with_client(|client| { |
| 29 | + let id = "sub_123".parse().unwrap(); |
| 30 | + let mut create = stripe::CreateSubscriptionItem::new(id); |
| 31 | + create.price_data = Some(stripe::SubscriptionItemPriceData { |
| 32 | + currency: stripe::Currency::USD, |
| 33 | + product: "My Product".to_string(), |
| 34 | + recurring: stripe::SubscriptionItemPriceDataRecurring { |
| 35 | + interval: stripe::SubscriptionItemInterval::Day, |
| 36 | + interval_count: Some(6), |
| 37 | + }, |
| 38 | + tax_behavior: None, |
| 39 | + unit_amount: None, |
| 40 | + unit_amount_decimal: None, |
| 41 | + }); |
| 42 | + let result = stripe::SubscriptionItem::create(client, create).unwrap(); |
| 43 | + }); |
| 44 | +} |
0 commit comments