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): compare migrated asar contents

tiammomo4b73930c7180
diff --git a/apps/desktop/src/main/__tests__/legacyUserDataMigration.test.ts b/apps/desktop/src/main/__tests__/legacyUserDataMigration.test.ts
index 9e4c0adc8d..e6279717c9 100644
--- a/apps/desktop/src/main/__tests__/legacyUserDataMigration.test.ts
+++ b/apps/desktop/src/main/__tests__/legacyUserDataMigration.test.ts
@@ -614,14 +614,17 @@ const path = require('node:path');
}
await originalFs.copyFile(source, destination);
- const [sourceStat, destinationStat] = await Promise.all([
+ const [sourceStat, destinationStat, sourceContents, destinationContents] = await Promise.all([
originalFs.stat(source),
originalFs.stat(destination),
+ originalFs.readFile(source),
+ originalFs.readFile(destination),
]);
process.stdout.write(JSON.stringify({
patchedCopyError,
copiedBytes: destinationStat.size,
sourceBytes: sourceStat.size,
+ contentsMatch: sourceContents.equals(destinationContents),
}));
} finally {
await originalFs.rm(tempDir, { recursive: true, force: true });
@@ -645,8 +648,10 @@ const path = require('node:path');
patchedCopyError: string | null;
copiedBytes: number;
sourceBytes: number;
+ contentsMatch: boolean;
};
expect([null, 'ENOENT']).toContain(output.patchedCopyError);
expect(output.copiedBytes).toBe(output.sourceBytes);
+ expect(output.contentsMatch).toBe(true);
});
});