feat: add project-aware agent workspace
This commit is contained in:
@@ -131,3 +131,16 @@ function createImageMap(loadImage: (path: string) => Promise<{ data: { width: nu
|
||||
addImage: ReturnType<typeof vi.fn>;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
it("does not access a disposed map after SCADA image loading completes", async () => {
|
||||
const controller = new AbortController();
|
||||
let resolve!: (value: { data: { width: number; height: number } }) => void;
|
||||
const map = createImageMap(() => new Promise((done) => { resolve = done; }));
|
||||
const pending = registerScadaImages(map, controller.signal);
|
||||
controller.abort();
|
||||
resolve({ data: { width: 64, height: 64 } });
|
||||
await expect(pending).resolves.toMatchObject({ status: "cancelled" });
|
||||
expect(map.addImage).not.toHaveBeenCalled();
|
||||
expect(map.loadImage).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user