diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-12-16 08:40:07 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-12-16 08:40:07 -0500 |
commit | cebd93586f32fb47cea2f86b9c87f9daea3da9b0 (patch) | |
tree | 69858ca585fcbbdc780e0fa3122bd97f6a9a7d1e /server/src | |
parent | 2205edfa06f3c9ddecfca2f01afc0f5e88c7d6fc (diff) |
Failing test for advance_play()
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/fake_auth.rs | 3 | ||||
-rw-r--r-- | server/src/main.rs | 2 | ||||
-rw-r--r-- | server/src/play.rs | 17 |
3 files changed, 16 insertions, 6 deletions
diff --git a/server/src/fake_auth.rs b/server/src/fake_auth.rs index d19d858..c0574af 100644 --- a/server/src/fake_auth.rs +++ b/server/src/fake_auth.rs @@ -5,10 +5,9 @@ use std::{ }; use async_trait::async_trait; -use chrono::{DateTime, Utc}; +use chrono::Utc; use openidconnect::{RefreshToken, AccessToken}; use reqwest::Url; -use tracing::info; use crate::{ auth::{AuthenticatedSession, Authenticator, SessionId, store_authenticated_session}, diff --git a/server/src/main.rs b/server/src/main.rs index cf42b3f..95e23e6 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -119,8 +119,6 @@ async fn main() { #[cfg(debug_assertions)] async fn fake_login() -> Html<&'static str> { - use axum::response::Html; - Html(r#" <!DOCTYPE html> <html lang="en"> diff --git a/server/src/play.rs b/server/src/play.rs index 33a14f9..9ea2f42 100644 --- a/server/src/play.rs +++ b/server/src/play.rs @@ -1,5 +1,5 @@ use async_trait::async_trait; -use protocol::{bridge_engine::{self, GameState, Player, Bid, Deal}}; +use protocol::{bridge_engine::{GameState, Player, Bid, Deal}}; use rand::random; use serde::{Deserialize, Serialize}; use serde_json::json; @@ -109,7 +109,7 @@ impl<J: Journal> Table<J> { } async fn init(journal: &mut J) -> Result<GameState, BridgeError> { - let game = GameState::new(random(), Player::East); + let game = GameState::new(random(), random()); journal.append(0, json!(game)).await?; Ok(game) } @@ -132,6 +132,11 @@ impl<J: Journal> Table<J> { } } + +pub fn advance_play<J: Journal>(table: &mut Table<J>) { + todo!() +} + #[cfg(test)] mod test { use super::*; @@ -198,4 +203,12 @@ mod test { let t2 = Table::replay(journal).await.unwrap(); assert_eq!(game, t2.game); } + + #[tokio::test] + async fn test_advance_play() { + let mut t1: Table<TestJournal> = Table::new(Default::default()).await.unwrap(); + let player = t1.game().current_player(); + advance_play(&mut t1); + assert_ne!(player, t1.game().current_player()); + } } |