import { describe, it, expect } from 'vitest' import { existsSync, statSync } from 'node:fs' import { fileURLToPath } from 'node:url' import { dirname, join } from 'node:path' // Regression guard: the `useAria2c` setting was a silent no-op because aria2c.exe // was never bundled — download.ts gates the --downloader flag on the file existing // (existsSync(getAria2cPath())), so with no binary the toggle did nothing. This // asserts the binary ships in resources/bin (where getBinDir/getAria2cPath resolve // it, and where electron-builder's extraResources copies it into packaged builds). const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..') const aria2cPath = join(repoRoot, 'resources', 'bin', 'aria2c.exe') describe('bundled aria2c', () => { it('ships aria2c.exe in resources/bin', () => { expect(existsSync(aria2cPath)).toBe(true) }) it('is a real executable, not an empty or git-lfs pointer placeholder', () => { // The real binary is ~5.6 MB; a pointer/placeholder would be a few hundred // bytes. 1 MB is a comfortable floor that catches either failure mode. expect(statSync(aria2cPath).size).toBeGreaterThan(1_000_000) }) })