Create a workspace in the environment test fixtures

Fresh databases stopped getting a default workspace with the home screen
(#660), so the fixtures from #654 that took the first workspace panicked
on an empty list. They now create one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-15 14:50:05 -07:00
co-authored by Claude Fable 5
parent 621f9c3b8f
commit caeebebc75
2 changed files with 11 additions and 3 deletions
+6 -2
View File
@@ -1037,7 +1037,7 @@ mod environment_tests {
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::time::{Duration, timeout};
use yaak_models::models::{EnvironmentVariable, HttpRequest, HttpRequestHeader};
use yaak_models::models::{EnvironmentVariable, HttpRequest, HttpRequestHeader, Workspace};
#[tokio::test]
async fn plugin_send_uses_override_and_fallback_and_rejects_invalid_ids_before_sending() {
@@ -1079,7 +1079,11 @@ mod environment_tests {
let (base, a, b, request) = query_manager
.with_tx(|db| {
let source = &UpdateSource::Background;
let workspace = db.list_workspaces()?.remove(0);
// Fresh databases no longer come with a workspace, so make one
let workspace = db.upsert_workspace(
&Workspace { name: "Test".into(), ..Default::default() },
source,
)?;
let vars = |value: &str| {
vec![EnvironmentVariable {
enabled: true,
@@ -232,7 +232,11 @@ mod tests {
let source = &UpdateSource::Background;
let (base, staging, folder) = manager
.with_tx(|db| {
let workspace = db.list_workspaces()?.remove(0);
// Fresh databases no longer come with a workspace, so make one
let workspace = db.upsert_workspace(
&Workspace { name: "Test".into(), ..Default::default() },
source,
)?;
let variable = |name: &str, value: &str| EnvironmentVariable {
enabled: true,
name: name.into(),