chore(repo): 移除重复版权文件头并纳入共享单测

集中保留原版权声明,移除文件头检查和全局测试忽略规则。验证:全量单测、受影响用例复测及静态检查通过。
This commit is contained in:
zhanjunhao
2026-11-20 11:23:49 +08:00
parent 605cff1d58
commit 2aa9d73325
943 changed files with 2213 additions and 17401 deletions
+34
View File
@@ -0,0 +1,34 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { getOrgQuotaAvailability } from '../../src/pages/Organization/orgQuotaAvailability.js';
test('quota availability uses unrounded remaining ratio and includes the 20% boundary', () => {
for (const [quota, used_quota, type] of [
[110855.34, 19254.66, 'success'],
[20.001, 79.999, 'success'],
[20, 80, 'warning'],
[19.999, 80.001, 'warning'],
[1, 99, 'warning'],
[1, 0, 'success'],
[0, 0, 'danger'],
[-1, 100, 'danger'],
['20', '80', 'warning'],
]) {
assert.equal(getOrgQuotaAvailability({ quota, used_quota }).type, type);
}
});
test('missing or invalid quota does not claim that credit is sufficient', () => {
for (const data of [
null,
{},
{ quota: null },
{ quota: '' },
{ quota: 'invalid' },
{ quota: Infinity },
{ quota: 10, used_quota: NaN },
{ quota: 10, used_quota: -1 },
]) {
assert.equal(getOrgQuotaAvailability(data), null);
}
});