mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-22 12:54:54 +01:00
test: show for which test workspace was
basically fixtures leak workspaces when errors occur, so to better debug what is happening every test now names its workspace. this is tedious and should probably be removed eventually but for now it helps a ton
This commit is contained in:
parent
752a682efc
commit
cd4e09c1cd
3 changed files with 12 additions and 12 deletions
|
@ -3,7 +3,7 @@ use super::{assert_or_err, fixtures::{ScopedFixture, WorkspaceFixture}};
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_buffer_search() {
|
||||
WorkspaceFixture::one("alice")
|
||||
WorkspaceFixture::one("alice", "test-buffer-search")
|
||||
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
@ -23,7 +23,7 @@ async fn test_buffer_search() {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_send_operation() {
|
||||
WorkspaceFixture::two("alice", "bob")
|
||||
WorkspaceFixture::two("alice", "bob", "test-send-operation")
|
||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
@ -53,7 +53,7 @@ async fn test_send_operation() {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_content_converges() {
|
||||
WorkspaceFixture::two("alice", "bob")
|
||||
WorkspaceFixture::two("alice", "bob", "test-content-converges")
|
||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
|
|
@ -89,19 +89,19 @@ impl WorkspaceFixture {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn one(user: &str) -> Self {
|
||||
pub fn one(user: &str, ws: &str) -> Self {
|
||||
Self {
|
||||
user: user.to_string(),
|
||||
invite: None,
|
||||
workspace: uuid::Uuid::new_v4().to_string(),
|
||||
workspace: format!("{ws}-{}", uuid::Uuid::new_v4()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn two(user: &str, invite: &str) -> Self {
|
||||
pub fn two(user: &str, invite: &str, ws: &str) -> Self {
|
||||
Self {
|
||||
user: user.to_string(),
|
||||
invite: Some(invite.to_string()),
|
||||
workspace: uuid::Uuid::new_v4().to_string(),
|
||||
workspace: format!("{ws}-{}", uuid::Uuid::new_v4()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::{assert_or_err, fixtures::{ClientFixture, ScopedFixture, WorkspaceFix
|
|||
|
||||
#[tokio::test]
|
||||
async fn cannot_delete_others_workspaces() {
|
||||
WorkspaceFixture::two("alice", "bob")
|
||||
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-workspaces")
|
||||
.with(|((_, ws_alice), (client_bob, _))| {
|
||||
let ws_alice = ws_alice.clone();
|
||||
let client_bob = client_bob.clone();
|
||||
|
@ -20,7 +20,7 @@ async fn cannot_delete_others_workspaces() {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_buffer_create() {
|
||||
WorkspaceFixture::one("alice")
|
||||
WorkspaceFixture::one("alice", "test-buffer-create")
|
||||
.with(|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
@ -38,7 +38,7 @@ async fn test_buffer_create() {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_cant_create_buffer_twice() {
|
||||
WorkspaceFixture::one("alice")
|
||||
WorkspaceFixture::one("alice", "test-cant-create-buffer-twice")
|
||||
.with(|(_, ws): &mut (crate::Client, crate::Workspace)| {
|
||||
let ws = ws.clone();
|
||||
async move {
|
||||
|
@ -56,7 +56,7 @@ async fn test_cant_create_buffer_twice() {
|
|||
#[tokio::test]
|
||||
#[ignore] // TODO server has no concept of buffer ownership!
|
||||
async fn cannot_delete_others_buffers() {
|
||||
WorkspaceFixture::two("alice", "bob")
|
||||
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-buffers")
|
||||
.with(|((_, workspace_alice), (_, workspace_bob))| {
|
||||
let buffer_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_alice = workspace_alice.clone();
|
||||
|
@ -76,7 +76,7 @@ async fn test_workspace_interactions() {
|
|||
if let Err(e) = async {
|
||||
let client_alice = ClientFixture::of("alice").setup().await?;
|
||||
let client_bob = ClientFixture::of("bob").setup().await?;
|
||||
let workspace_name = uuid::Uuid::new_v4().to_string();
|
||||
let workspace_name = format!("test-workspace-interactions-{}", uuid::Uuid::new_v4().to_string());
|
||||
|
||||
client_alice.create_workspace(&workspace_name).await?;
|
||||
let owned_workspaces = client_alice.fetch_owned_workspaces().await?;
|
||||
|
|
Loading…
Reference in a new issue