Initial commit: DSH Web Manager

This commit is contained in:
2026-10-13 09:34:47 +08:00
commit 85332bbc56
135 changed files with 19712 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import { describe, expect, it } from 'vitest';
import { GiB, quotaBytes } from './quota';
describe('quota validation', () => {
it('converts presets and fractional GiB to integer bytes', () => {
for (const n of [5,10,20,50]) expect(quotaBytes(String(n))).toBe(n * GiB);
expect(quotaBytes('0.1')).toBe(Math.round(GiB / 10));
expect(quotaBytes('10')).toBe(quotaBytes('10.0'));
});
it('rejects empty, nonfinite, negative and unsafe values', () => {
for (const value of ['', ' ', 'invalid', '0', '-5', '0.09', 'Infinity', 'NaN', '1e30']) expect(quotaBytes(value)).toBeNull();
});
});