Align capacity units and scope administrator network edits

This commit is contained in:
2026-10-15 14:20:39 +09:00
parent 9cda9cbe84
commit 60a14e9c6c
14 changed files with 458 additions and 259 deletions

View File

@@ -1,20 +1,27 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { formatSize, formatAdminDate } from '../../web/src/displayFormat.js';
import {
formatSize,
formatAdminDate,
SIZE_KB,
SIZE_MB,
SIZE_GB,
} from '../../web/src/displayFormat.js';
test('shared display sizes use decimal KB below 1MB and switch only at MB/GB boundaries', () => {
test('shared display uses familiar 1024-based KB/MB/GB with comma grouping and readable whole-GB quotas', () => {
for (const [bytes, expected] of [
[0, '0KB'],
[10, '1KB 미만'],
[1000, '1KB'],
[938000, '938KB'],
[999000, '999KB'],
[1000000, '1.0MB'],
[1100000, '1.1MB'],
[1000000000, '1.0GB'],
[1700000000, '1.7GB'],
[7687e9, '7,687.0GB'],
[1234567e9, '1,234,567.0GB'],
[SIZE_KB, '1KB'],
[938 * SIZE_KB, '938KB'],
[1023 * SIZE_KB, '1,023KB'],
[SIZE_MB, '1.0MB'],
[1.1 * SIZE_MB, '1.1MB'],
[SIZE_GB, '1.0GB'],
[1.7 * SIZE_GB, '1.7GB'],
[20 * SIZE_GB, '20.0GB'],
[7687 * SIZE_GB, '7,687.0GB'],
[1234567 * SIZE_GB, '1,234,567.0GB'],
])
assert.equal(formatSize(bytes), expected);
});