pub mod metering;
pub mod plans;
pub use metering::{metered_usage, Usage};
pub use plans::{entitlement_allows, min_plan_for, Entitlements, Plan};
#[cfg(test)]
mod tests {
use super::*;
use crate::core::server_capabilities::{LOCAL_ALWAYS_ON_FEATURES, LOCAL_OPTIONAL_FEATURES};
#[test]
fn no_local_feature_is_gated_by_any_plan() {
for plan in Plan::all() {
for feature in LOCAL_ALWAYS_ON_FEATURES
.iter()
.chain(LOCAL_OPTIONAL_FEATURES.iter())
{
assert!(
entitlement_allows(*plan, feature),
"local feature '{feature}' gated on plan {plan:?}"
);
}
}
}
#[test]
fn commercial_entitlements_exist_only_above_free() {
assert!(!entitlement_allows(Plan::Free, "sso_scim"));
assert!(entitlement_allows(Plan::Enterprise, "sso_scim"));
assert!(entitlement_allows(Plan::Team, "private_registry"));
assert!(!entitlement_allows(Plan::Free, "private_registry"));
}
}