story-kit: merge 77_bug_create_bug_file_writes_no_yaml_front_matter
This commit is contained in:
@@ -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 userEvent from "@testing-library/user-event";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { AgentConfigInfo, AgentInfo } from "../api/agents";
|
import type { AgentConfigInfo, AgentInfo } from "../api/agents";
|
||||||
@@ -315,7 +315,7 @@ describe("AgentPanel fade-out", () => {
|
|||||||
|
|
||||||
describe("removes the agent entry after 60s", () => {
|
describe("removes the agent entry after 60s", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.useFakeTimers();
|
vi.useFakeTimers({ shouldAdvanceTime: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -346,17 +346,17 @@ describe("AgentPanel fade-out", () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advance timers by 60 seconds
|
// Advance timers by 60 seconds and flush React state updates
|
||||||
vi.advanceTimersByTime(60_000);
|
await act(async () => {
|
||||||
|
vi.advanceTimersByTime(60_000);
|
||||||
|
});
|
||||||
|
|
||||||
// Entry should be removed
|
// Entry should be removed
|
||||||
await waitFor(() => {
|
expect(
|
||||||
expect(
|
container.querySelector(
|
||||||
container.querySelector(
|
'[data-testid="agent-entry-73_remove_test:coder-1"]',
|
||||||
'[data-testid="agent-entry-73_remove_test:coder-1"]',
|
),
|
||||||
),
|
).not.toBeInTheDocument();
|
||||||
).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -238,6 +238,10 @@ pub fn create_bug_file(
|
|||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let mut content = String::new();
|
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(&format!("# Bug {bug_number}: {name}\n\n"));
|
||||||
content.push_str("## Description\n\n");
|
content.push_str("## Description\n\n");
|
||||||
content.push_str(description);
|
content.push_str(description);
|
||||||
@@ -1266,6 +1270,10 @@ mod tests {
|
|||||||
.join(".story_kit/work/1_upcoming/1_bug_login_crash.md");
|
.join(".story_kit/work/1_upcoming/1_bug_login_crash.md");
|
||||||
assert!(filepath.exists());
|
assert!(filepath.exists());
|
||||||
let contents = fs::read_to_string(&filepath).unwrap();
|
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("# Bug 1: Login Crash"));
|
||||||
assert!(contents.contains("## Description"));
|
assert!(contents.contains("## Description"));
|
||||||
assert!(contents.contains("The login page crashes on submit."));
|
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 filepath = tmp.path().join(".story_kit/work/1_upcoming/1_bug_some_bug.md");
|
||||||
let contents = fs::read_to_string(&filepath).unwrap();
|
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"));
|
assert!(contents.contains("- [ ] Bug is fixed and verified"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user