Files
Multi-Hoster-Upload/tests/file-discovery.test.js
T
Sucukdeluxe 2ba0106ef0
CI / verify (push) Waiting to run
release: v2.1.12 reliability and security hardening
Verify update artifacts with exact metadata and SHA-512, require host-confirmed upload completion before cleanup, harden credentials and backups, improve queue recovery and skipped-state reporting, expand Windows path coverage, and add CI packaging checks.
2026-08-11 22:36:21 +02:00

39 lines
1.4 KiB
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const path = require('node:path');
const { walkFolderAsync } = require('../lib/file-discovery');
function directory(name) {
return { name, isDirectory: () => true, isFile: () => false };
}
function file(name) {
return { name, isDirectory: () => false, isFile: () => true };
}
test('folder discovery preserves UNC and Unicode paths', async () => {
const root = '\\\\server\\share\\Übertragungen';
const child = path.win32.join(root, 'Staffel 1');
const target = path.win32.join(child, 'Folge äöü.mkv');
const fsPromises = {
readdir: async dir => dir === root ? [directory('Staffel 1')] : [file('Folge äöü.mkv')],
stat: async value => ({ size: value === target ? 1234 : 0 })
};
const result = await walkFolderAsync(root, { fsPromises, pathImpl: path.win32 });
assert.deepEqual(result, [{ path: target, name: 'Folge äöü.mkv', size: 1234 }]);
});
test('folder discovery does not truncate long absolute paths', async () => {
const root = `C:\\${'sehr-langer-ordner\\'.repeat(18)}ziel`;
const target = path.win32.join(root, 'video.mp4');
const result = await walkFolderAsync(root, {
fsPromises: {
readdir: async () => [file('video.mp4')],
stat: async () => ({ size: 77 })
},
pathImpl: path.win32
});
assert.equal(result[0].path, target);
assert.ok(result[0].path.length > 260);
});