Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(desktop): await import transaction before slug assertions

DavidShen44cecfd653ab
diff --git a/apps/desktop/src/main/bot-import/__tests__/host.test.ts b/apps/desktop/src/main/bot-import/__tests__/host.test.ts
index 3f28576d06..21b55d5af4 100644
--- a/apps/desktop/src/main/bot-import/__tests__/host.test.ts
+++ b/apps/desktop/src/main/bot-import/__tests__/host.test.ts
@@ -662,7 +662,10 @@ it('does not reintroduce a credential-bearing skill slug in the generated resour
const preview = await previewCompanionImport(source!.id, 'fixture');
const requestId = 'fixture-slug-12345';
const result = await startCompanionImport({ requestId, previewId: preview.id, name: 'Ada', entryIds: ['skill', 'env'], takeover: false }, 'fixture');
- await vi.waitFor(async () => expect((await getCompanionImportResult(requestId))?.status).toBe('complete'));
+ // Acceptance may precede filesystem writes; join the import transaction before
+ // checking published content or letting teardown remove its directory.
+ const completed = await withBotProfileLocks([result.botId], () => getCompanionImportResult(requestId));
+ expect(completed?.status).toBe('complete');
const directory = path.join(h.root, 'bots', result.botId, 'skills');
const [slug] = await fs.readdir(directory);
expect(slug).toMatch(/^import-[a-f0-9]+$/);