#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TemplateCard {
pub name: String,
pub shape: String,
pub description: String,
pub ready: bool,
}
#[must_use]
pub fn template_cards() -> Vec<TemplateCard> {
let mut cards = vec![TemplateCard {
name: "Empty".to_string(),
shape: "Blank design".to_string(),
description: "No starting tiers -- author the schedule from scratch.".to_string(),
ready: true,
}];
for spec in indicatrix_cut_core::templates::TEMPLATES {
cards.push(TemplateCard {
name: spec.name.to_string(),
shape: spec.shape.to_string(),
description: spec.description.to_string(),
ready: true,
});
}
cards
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_template_gets_a_card_after_empty() {
let cards = template_cards();
assert_eq!(
cards.len(),
indicatrix_cut_core::templates::TEMPLATES.len() + 1
);
assert_eq!(cards[0].name, "Empty");
assert!(cards.iter().all(|card| card.ready));
assert_eq!(
cards[1].name,
indicatrix_cut_core::templates::TEMPLATES[0].name
);
}
}