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): tolerate formatting in bootstrap wiring contracts

kirozengc057fe2f68cb
diff --git a/apps/desktop/src/main/__tests__/ghostAccountBoundaryOrdering.test.ts b/apps/desktop/src/main/__tests__/ghostAccountBoundaryOrdering.test.ts
index 391acc5fbc..1603b435c3 100644
--- a/apps/desktop/src/main/__tests__/ghostAccountBoundaryOrdering.test.ts
+++ b/apps/desktop/src/main/__tests__/ghostAccountBoundaryOrdering.test.ts
@@ -18,13 +18,22 @@ describe('Ghost account-boundary teardown ordering', () => {
'async function teardownGhostProjectionBoundary(reason: string): Promise<void> {',
);
const end = bootstrap.indexOf('\n}\n', start);
+ expect(start).toBeGreaterThan(-1);
+ expect(end).toBeGreaterThan(start);
const body = bootstrap.slice(start, end);
- const interrupt = body.indexOf('interruptGhostCallsForAccountBoundary));');
- const wait = body.indexOf('waitForGhostMutations));');
- const suspend = body.indexOf('suspendAllGhosts);');
+ // Match complete awaited calls, allowing formatter-only whitespace/trailing commas.
+ const interrupt = body.search(
+ /await\s+run\(\s*'interruptGhostCallsForAccountBoundary'\s*,\s*\(\s*\)\s*=>\s*withAuthBoundaryTimeout\(\s*'interrupt Ghost calls'\s*,\s*interruptGhostCallsForAccountBoundary\s*,?\s*\)\s*,?\s*\)\s*;/,
+ );
+ const wait = body.search(
+ /await\s+run\(\s*'waitForGhostMutations'\s*,\s*\(\s*\)\s*=>\s*withAuthBoundaryTimeout\(\s*'wait for Ghost mutations'\s*,\s*waitForGhostMutations\s*,?\s*\)\s*,?\s*\)\s*;/,
+ );
+ const suspend = body.search(/await\s+run\(\s*'suspendAllGhosts'\s*,\s*suspendAllGhosts\s*,?\s*\)\s*;/);
expect(interrupt).toBeGreaterThan(-1);
+ expect(wait).toBeGreaterThan(-1);
+ expect(suspend).toBeGreaterThan(-1);
expect(interrupt).toBeLessThan(wait);
expect(wait).toBeLessThan(suspend);
});
diff --git a/apps/desktop/src/main/maker-host/__tests__/accountProviderReadinessWiring.test.ts b/apps/desktop/src/main/maker-host/__tests__/accountProviderReadinessWiring.test.ts
index 7fa27d385a..68ba1eb170 100644
--- a/apps/desktop/src/main/maker-host/__tests__/accountProviderReadinessWiring.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/accountProviderReadinessWiring.test.ts
@@ -164,8 +164,8 @@ describe('account provider readiness wiring', () => {
/handle\.isLive\(\)\s*&&\s*accountProviderReadinessBarrier\.isCurrentAdoptable\(\)/,
);
- expect(bootstrapSource).toContain(
- 'accountProviderReadinessArm.publish(userId, startProviderReadiness, resumeIncompleteDiscovery)',
+ expect(bootstrapSource).toMatch(
+ /accountProviderReadinessArm\.publish\(\s*userId\s*,\s*startProviderReadiness\s*,\s*resumeIncompleteDiscovery\s*,?\s*\)/,
);
expect(bootstrapSource).toContain('accountProviderReadinessArm.clear()');
expect(bootstrapSource).toContain('startPendingAccountProviderReadiness = null');
diff --git a/apps/desktop/src/renderer/__tests__/windowBackdropAcrylic.test.ts b/apps/desktop/src/renderer/__tests__/windowBackdropAcrylic.test.ts
index 86fe5dd7ec..12694c2d1f 100644
--- a/apps/desktop/src/renderer/__tests__/windowBackdropAcrylic.test.ts
+++ b/apps/desktop/src/renderer/__tests__/windowBackdropAcrylic.test.ts
@@ -57,12 +57,10 @@ describe('Windows Acrylic resize backing contract', () => {
});
it('keeps the root material attribute in sync with runtime material changes', () => {
- expect(bootstrapSource).toContain(
- 'win.webContents.send(\n WINDOW_BACKDROP_MATERIAL_CHANGED_CHANNEL,\n config.backgroundMaterial,\n )',
- );
- expect(secondaryWindowsSource).toContain(
- 'win.webContents.send(\n WINDOW_BACKDROP_MATERIAL_CHANGED_CHANNEL,\n config.backgroundMaterial,\n )',
- );
+ const materialChangedSend =
+ /win\.webContents\.send\(\s*WINDOW_BACKDROP_MATERIAL_CHANGED_CHANNEL\s*,\s*config\.backgroundMaterial\s*,?\s*\)/;
+ expect(bootstrapSource).toMatch(materialChangedSend);
+ expect(secondaryWindowsSource).toMatch(materialChangedSend);
expect(preloadSource).toContain(
'fanOutWindowBackdropMaterialChanged((material) => {\n if (typeof material === \'string\' && isWindowsBackdropMaterial(material))',
);