镜像自地址
https://github.com/lhly/cloud-drive-renamer.git
已同步 2026-10-20 21:57:47 +08:00
新增 OneDrive 个人版适配器、MAIN 桥接、名称校验与冲突检测、目录身份与分页遍历。同步更新三语简介、商店素材、仓库描述及 manifest 域名注册。修复面板键盘冒泡至宿主页面的隔离与工具栏 Escape 作用域。修正 OneDrive 同步结果语义为手动刷新提示, 避免误报同步失败。补全对应单测与浏览器验收脚本。
18 行
909 B
TypeScript
18 行
909 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { validateOneDriveName } from '../../../src/adapters/onedrive/adapter';
|
|
|
|
describe('OneDrive name validation', () => {
|
|
it('accepts ordinary Unicode names and measures characters rather than UTF-8 bytes', () => {
|
|
expect(() => validateOneDriveName(`${'中'.repeat(250)}.txt`, 20)).not.toThrow();
|
|
});
|
|
|
|
it('rejects OneDrive-invalid whitespace, characters, reserved names and excessive paths', () => {
|
|
expect(() => validateOneDriveName('file.lock')).not.toThrow();
|
|
for (const name of ['', ' ', ' leading.txt', 'trailing .txt ', 'name.', 'bad/name', 'CON.txt', 'desktop.ini', '.lock', '~$draft.docx', 'x_vti_y.txt']) {
|
|
expect(() => validateOneDriveName(name)).toThrow();
|
|
}
|
|
expect(() => validateOneDriveName('a'.repeat(256))).toThrow(/long/i);
|
|
expect(() => validateOneDriveName('中文.txt', 398)).toThrow(/path/i);
|
|
});
|
|
});
|