mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
test(studio): wait for the first undo press before the edit that should block the second (#6652)
This commit is contained in:
@@ -317,8 +317,12 @@ it("refuses a second press whose edit is undone once an edit was made after the
|
||||
return run;
|
||||
};
|
||||
const press = () => hook().undo({ readFile, claimedAfter: atKey, serialize });
|
||||
const presses = Promise.all([press(), press()]);
|
||||
await vi.waitFor(() => expect(file()).toBe("B"));
|
||||
const firstPress = press();
|
||||
const secondPress = press();
|
||||
// The first press must be over, not only its file written: the undo's closing sweep would take card.html
|
||||
// into the undo, and the claim below would then hold nothing.
|
||||
const first = await act(() => firstPress);
|
||||
expect(file()).toBe("B");
|
||||
writeFileSync(join(dir, "card.html"), "Y");
|
||||
await act(() =>
|
||||
hook().recordEdit({
|
||||
@@ -328,7 +332,7 @@ it("refuses a second press whose edit is undone once an edit was made after the
|
||||
);
|
||||
|
||||
open();
|
||||
const [first, second] = await act(() => presses);
|
||||
const second = await act(() => secondPress);
|
||||
|
||||
expect(first).toMatchObject({ ok: true, label: "Undid: Moved Card" });
|
||||
expect(second).toMatchObject({ ok: false, reason: "content-mismatch" });
|
||||
|
||||
Reference in New Issue
Block a user