chore: removed need of adding type hints

Co-authored-by: cschen <cschen@codemp.dev>
This commit is contained in:
əlemi 2024-11-05 00:15:17 +01:00
parent 888f7fd80c
commit ee2ced51ca
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 13 additions and 29 deletions

View file

@ -222,7 +222,7 @@ async fn test_deleting_twice_or_non_existing_is_an_error() {
async fn test_invite_user_to_workspace_and_invited_lookup() {
WorkspaceFixture::one("bob", "workspace-di-bob")
.with(
|(client_bob, workspace_bob): &mut (crate::Client, crate::Workspace)| {
|(client_bob, workspace_bob)| {
let client_bob = client_bob.clone();
let workspace_bob = workspace_bob.clone();
@ -284,7 +284,7 @@ async fn test_invite_user_to_workspace_and_invited_lookup() {
#[tokio::test]
async fn cannot_delete_others_workspaces() {
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-workspaces")
.with(|((_, ws_alice), (client_bob, _))| {
.with(|(_, ws_alice, client_bob, _)| {
let ws_alice = ws_alice.clone();
let client_bob = client_bob.clone();
async move {
@ -302,7 +302,7 @@ async fn cannot_delete_others_workspaces() {
async fn test_buffer_search() {
WorkspaceFixture::one("alice", "test-buffer-search")
.with(
|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|(_, workspace_alice)| {
let buffer_name = uuid::Uuid::new_v4().to_string();
let workspace_alice = workspace_alice.clone();
@ -323,7 +323,7 @@ async fn test_buffer_search() {
#[tokio::test]
async fn test_send_operation() {
WorkspaceFixture::two("alice", "bob", "test-send-operation")
.with(|((_, workspace_alice), (_, workspace_bob))| {
.with(|(_, workspace_alice, _, workspace_bob)| {
let buffer_name = uuid::Uuid::new_v4().to_string();
let workspace_alice = workspace_alice.clone();
let workspace_bob = workspace_bob.clone();
@ -353,7 +353,7 @@ async fn test_send_operation() {
#[tokio::test]
async fn test_content_converges() {
WorkspaceFixture::two("alice", "bob", "test-content-converges")
.with(|((_, workspace_alice), (_, workspace_bob))| {
.with(|(_, workspace_alice, _, workspace_bob)| {
let buffer_name = uuid::Uuid::new_v4().to_string();
let workspace_alice = workspace_alice.clone();
let workspace_bob = workspace_bob.clone();

View file

@ -124,21 +124,8 @@ impl ScopedFixture<(crate::Client, crate::Workspace)> for WorkspaceFixture {
}
}
impl
ScopedFixture<(
(crate::Client, crate::Workspace),
(crate::Client, crate::Workspace),
)> for WorkspaceFixture
{
async fn setup(
&mut self,
) -> Result<
(
(crate::Client, crate::Workspace),
(crate::Client, crate::Workspace),
),
Box<dyn Error>,
> {
impl ScopedFixture<(crate::Client, crate::Workspace, crate::Client, crate::Workspace)> for WorkspaceFixture {
async fn setup(&mut self) -> Result<(crate::Client, crate::Workspace, crate::Client, crate::Workspace), Box<dyn Error>> {
let client = ClientFixture::of(&self.user).setup().await?;
let invitee_client = ClientFixture::of(
&self
@ -154,17 +141,14 @@ impl
.await?;
let workspace = client.attach_workspace(&self.workspace).await?;
let invitee_workspace = invitee_client.attach_workspace(&self.workspace).await?;
Ok(((client, workspace), (invitee_client, invitee_workspace)))
Ok((client, workspace, invitee_client, invitee_workspace))
}
async fn cleanup(
&mut self,
resource: Option<(
(crate::Client, crate::Workspace),
(crate::Client, crate::Workspace),
)>,
resource: Option<(crate::Client, crate::Workspace, crate::Client, crate::Workspace)>,
) {
if let Some(((client, _), (_, _))) = resource {
if let Some((client, _, _, _)) = resource {
client.leave_workspace(&self.workspace);
if let Err(e) = client.delete_workspace(&self.workspace).await {
eprintln!("could not delete workspace: {e}");

View file

@ -26,7 +26,7 @@ use super::{
async fn test_buffer_create() {
WorkspaceFixture::one("alice", "test-buffer-create")
.with(
|(_, workspace_alice): &mut (crate::Client, crate::Workspace)| {
|(_, workspace_alice)| {
let buffer_name = uuid::Uuid::new_v4().to_string();
let workspace_alice = workspace_alice.clone();
@ -47,7 +47,7 @@ async fn test_buffer_create() {
#[tokio::test]
async fn test_cant_create_buffer_twice() {
WorkspaceFixture::one("alice", "test-cant-create-buffer-twice")
.with(|(_, ws): &mut (crate::Client, crate::Workspace)| {
.with(|(_, ws)| {
let ws = ws.clone();
async move {
ws.create_buffer("cacca").await?;
@ -65,7 +65,7 @@ async fn test_cant_create_buffer_twice() {
#[ignore] // TODO server has no concept of buffer ownership!
async fn cannot_delete_others_buffers() {
WorkspaceFixture::two("alice", "bob", "test-cannot-delete-others-buffers")
.with(|((_, workspace_alice), (_, workspace_bob))| {
.with(|(_, workspace_alice, _, workspace_bob)| {
let buffer_name = uuid::Uuid::new_v4().to_string();
let workspace_alice = workspace_alice.clone();
let workspace_bob = workspace_bob.clone();