100-exercises-to-learn-rust/exercises/07_threads/09_bounded/tests/insert.rs

21 lines
629 B
Rust
Raw Normal View History

2024-05-12 22:21:03 +02:00
use bounded::data::{Status, TicketDraft};
use bounded::launch;
use ticket_fields::test_helpers::{ticket_description, ticket_title};
#[test]
fn works() {
let client = launch(5);
let draft = TicketDraft {
title: ticket_title(),
description: ticket_description(),
};
let ticket_id = client.insert(draft.clone()).unwrap();
let client2 = client.clone();
let ticket = client2.get(ticket_id).unwrap().unwrap();
assert_eq!(ticket_id, ticket.id);
assert_eq!(ticket.status, Status::ToDo);
assert_eq!(ticket.title, draft.title);
assert_eq!(ticket.description, draft.description);
}