Fix errors in tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
032946978c
commit
78f4cc3965
4 changed files with 9 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::asciicast::{Event, EventKind, Header, HeaderBuilder};
|
||||
use crate::asciicast::{Event, Header};
|
||||
|
||||
/// Message used by Liveterm for broadcasts
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
|
@ -15,18 +15,8 @@ pub struct ServerHello {
|
|||
|
||||
#[test]
|
||||
fn test() {
|
||||
let msg = Message::AsciicastHeader(
|
||||
HeaderBuilder::default()
|
||||
.width(30)
|
||||
.height(30)
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
println!("{}", serde_json::to_string(&msg).unwrap());
|
||||
}
|
||||
use crate::asciicast::EventKind;
|
||||
|
||||
#[test]
|
||||
fn test2() {
|
||||
const msg: &'static str = "{\"AsciicastEvent\":[0.058985141,\"o\",\"\\u001b[1m\\u001b[3m%\\u001b[23m\\u001b[1m\\u001b[0m \\r \\r\"]}";
|
||||
let msg2: Message = serde_json::from_str(&msg).unwrap();
|
||||
if let Message::AsciicastEvent(ref evt) = msg2 {
|
||||
|
|
|
@ -12,10 +12,10 @@ use dashmap::{mapref::entry::Entry, DashMap};
|
|||
use futures::{future::BoxFuture, FutureExt};
|
||||
use rand::{prelude::Distribution, Rng};
|
||||
use serde::Deserialize;
|
||||
use tokio::sync::broadcast::{self, Receiver, Sender};
|
||||
use tokio::sync::broadcast::{self, Sender};
|
||||
|
||||
use crate::{
|
||||
asciicast::{Event, Header},
|
||||
asciicast::{Header},
|
||||
message::{Message, ServerHello},
|
||||
};
|
||||
|
||||
|
@ -89,7 +89,7 @@ async fn handle_websocket_inner(
|
|||
Some(v) => deserialize_message(&v?)?,
|
||||
None => bail!("send a header please..."),
|
||||
};
|
||||
let header: Header = match msg {
|
||||
let _header: Header = match msg {
|
||||
Message::AsciicastHeader(header) => header,
|
||||
_ => bail!("please send header omg!!!"),
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use anyhow::{Context, Result};
|
||||
use anyhow::{Result};
|
||||
use axum::{
|
||||
extract::{
|
||||
ws::{Message as WsMessage, WebSocket},
|
||||
|
|
|
@ -6,10 +6,10 @@ use std::net::SocketAddr;
|
|||
|
||||
use anyhow::Result;
|
||||
use axum::{
|
||||
extract::{Path, WebSocketUpgrade},
|
||||
http::{Response, StatusCode},
|
||||
extract::{Path},
|
||||
http::{StatusCode},
|
||||
response::Html,
|
||||
routing::{get, post},
|
||||
routing::{get},
|
||||
Router,
|
||||
};
|
||||
use tera::{Context, Tera};
|
||||
|
|
Loading…
Reference in a new issue