mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-07 13:08:54 -07:00
test(clipboard-queue): write scratch file to os.tmpdir instead of dist/
Auto-discovery in the new test lanes runs clipboard-queue.test.ts, which was never in the old hand-maintained lists. It wrote its stub media file to dist/, which does not exist during the source-test step on a fresh CI checkout (build runs later), so the suite failed. Use a real temp dir.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { appendClipboardVideoToQueueRuntime } from './clipboard-queue';
|
import { appendClipboardVideoToQueueRuntime } from './clipboard-queue';
|
||||||
|
|
||||||
@@ -27,7 +28,8 @@ test('appendClipboardVideoToQueueRuntime rejects unsupported clipboard path', ()
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('appendClipboardVideoToQueueRuntime queues readable media file', () => {
|
test('appendClipboardVideoToQueueRuntime queues readable media file', () => {
|
||||||
const tempPath = path.join(process.cwd(), 'dist', 'clipboard-queue-test-video.mkv');
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'clipboard-queue-'));
|
||||||
|
const tempPath = path.join(tempDir, 'clipboard-queue-test-video.mkv');
|
||||||
fs.writeFileSync(tempPath, 'stub');
|
fs.writeFileSync(tempPath, 'stub');
|
||||||
|
|
||||||
const commands: Array<(string | number)[]> = [];
|
const commands: Array<(string | number)[]> = [];
|
||||||
@@ -43,5 +45,5 @@ test('appendClipboardVideoToQueueRuntime queues readable media file', () => {
|
|||||||
assert.deepEqual(commands[0], ['loadfile', tempPath, 'append']);
|
assert.deepEqual(commands[0], ['loadfile', tempPath, 'append']);
|
||||||
assert.equal(osdMessages[0], `Queued from clipboard: ${path.basename(tempPath)}`);
|
assert.equal(osdMessages[0], `Queued from clipboard: ${path.basename(tempPath)}`);
|
||||||
|
|
||||||
fs.unlinkSync(tempPath);
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user