You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
|
|
const root = new URL('../', import.meta.url);
|
|
const sources = new Map(await Promise.all([
|
|
'public/cloud/runtime.js',
|
|
'public/cloud/instances.js',
|
|
'public/cloud/detail.js',
|
|
'public/cloud/invoice-detail-runtime.js',
|
|
'public/theme/venix/js/user-home.js',
|
|
].map(async path => [path, await readFile(new URL(path, root), 'utf8')])));
|
|
|
|
for (const [path, source] of sources) {
|
|
assert.doesNotMatch(source, /已复制|复制成功|已复制到剪贴板/,
|
|
`${path} still displays a success message after copying.`);
|
|
}
|
|
|
|
const runtime = sources.get('public/cloud/runtime.js');
|
|
const instances = sources.get('public/cloud/instances.js');
|
|
const detail = sources.get('public/cloud/detail.js');
|
|
const invoice = sources.get('public/cloud/invoice-detail-runtime.js');
|
|
const account = sources.get('public/theme/venix/js/user-home.js');
|
|
|
|
assert.match(runtime, /浏览器无法复制,请手动选择文本/,
|
|
'Shared VM copy failures no longer explain how to recover.');
|
|
assert.match(instances, /复制失败|浏览器无法复制/,
|
|
'Instance-list copy failures no longer notify the user.');
|
|
assert.match(detail, /copyText\([^)]+\)[\s\S]{0,120}catch \(error\) \{ toast\(error\.message, 'error'\); \}/,
|
|
'Instance-detail copy failures are no longer surfaced.');
|
|
assert.match(invoice, /浏览器无法复制,请手动选择文本/,
|
|
'Invoice copy failures no longer explain how to recover.');
|
|
assert.match(account, /复制失败,请手动复制/,
|
|
'Account-page copy failures are no longer surfaced.');
|
|
|
|
console.log('User copy actions stay silent on success and visible on failure.');
|