Skip to content

Commit 08614e7

Browse files
test(web): reset diff drafts after each test and keep the one-frame find timing
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bdfd0bf commit 08614e7

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎apps/web/src/components/chat/threadFindHighlights.browser.test.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ describe("find highlight caching", () => {
158158
/>,
159159
);
160160
await act(nextFrame);
161-
await act(nextFrame);
162161
expect(activeRanges()[0]?.toString()).toBe("COD4");
163162
});
164163

‎apps/web/src/components/diffs/AnnotatableCodeView.browser.test.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,18 @@ function typeComment(text: string) {
122122
});
123123
}
124124

125-
function setup() {
126-
useComposerDraftStore.setState(useComposerDraftStore.getInitialState(), true);
125+
function setup(): Disposable {
126+
const reset = () => useComposerDraftStore.setState(useComposerDraftStore.getInitialState(), true);
127+
reset();
127128
container = document.createElement("div");
129+
return { [Symbol.dispose]: reset };
128130
}
129131

130132
describe("diff comment drafts", () => {
131133
it.each(["removed file", "replaced rename"] as const)(
132134
"allows a fresh comment after a %s loses its draft",
133135
async (scenario) => {
134-
setup();
136+
using _drafts = setup();
135137
const original =
136138
scenario === "removed file"
137139
? file("a.ts")
@@ -172,7 +174,7 @@ describe("diff comment drafts", () => {
172174
);
173175

174176
it("keeps the text and selected line through refresh and a provisional lazy patch", async () => {
175-
setup();
177+
using _drafts = setup();
176178
const original = file("shared.ts", 1, "rename-pure", "old.ts");
177179
await using screen = await render(view([original]), { container });
178180
await click("Comment on shared.ts");

0 commit comments

Comments
 (0)