story-kit: merge 77_bug_create_bug_file_writes_no_yaml_front_matter

This commit is contained in:
Dave
2026-02-23 14:56:08 +00:00
parent 532031102d
commit 6e9b5da458
2 changed files with 23 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
import { render, screen, waitFor } from "@testing-library/react";
import { act, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { AgentConfigInfo, AgentInfo } from "../api/agents";
@@ -315,7 +315,7 @@ describe("AgentPanel fade-out", () => {
describe("removes the agent entry after 60s", () => {
beforeEach(() => {
vi.useFakeTimers();
vi.useFakeTimers({ shouldAdvanceTime: true });
});
afterEach(() => {
@@ -346,11 +346,12 @@ describe("AgentPanel fade-out", () => {
).toBeInTheDocument();
});
// Advance timers by 60 seconds
// Advance timers by 60 seconds and flush React state updates
await act(async () => {
vi.advanceTimersByTime(60_000);
});
// Entry should be removed
await waitFor(() => {
expect(
container.querySelector(
'[data-testid="agent-entry-73_remove_test:coder-1"]',
@@ -358,5 +359,4 @@ describe("AgentPanel fade-out", () => {
).not.toBeInTheDocument();
});
});
});
});

View File

@@ -238,6 +238,10 @@ pub fn create_bug_file(
.to_string();
let mut content = String::new();
content.push_str("---\n");
content.push_str(&format!("name: \"{}\"\n", name.replace('"', "\\\"")));
content.push_str("test_plan: pending\n");
content.push_str("---\n\n");
content.push_str(&format!("# Bug {bug_number}: {name}\n\n"));
content.push_str("## Description\n\n");
content.push_str(description);
@@ -1266,6 +1270,10 @@ mod tests {
.join(".story_kit/work/1_upcoming/1_bug_login_crash.md");
assert!(filepath.exists());
let contents = fs::read_to_string(&filepath).unwrap();
assert!(
contents.starts_with("---\nname: \"Login Crash\"\ntest_plan: pending\n---"),
"bug file must start with YAML front matter"
);
assert!(contents.contains("# Bug 1: Login Crash"));
assert!(contents.contains("## Description"));
assert!(contents.contains("The login page crashes on submit."));
@@ -1305,6 +1313,10 @@ mod tests {
let filepath = tmp.path().join(".story_kit/work/1_upcoming/1_bug_some_bug.md");
let contents = fs::read_to_string(&filepath).unwrap();
assert!(
contents.starts_with("---\nname: \"Some Bug\"\ntest_plan: pending\n---"),
"bug file must have YAML front matter"
);
assert!(contents.contains("- [ ] Bug is fixed and verified"));
}
}