refactor: rename formatMemoryUsage to formatBytes (#14997)

Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
This commit is contained in:
Mark Cockram
2026-01-27 17:21:53 +01:00
committed by GitHub
parent 362384112e
commit db028bc19a
9 changed files with 22 additions and 22 deletions

View File

@@ -7,23 +7,23 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
formatDuration,
formatMemoryUsage,
formatBytes,
formatTimeAgo,
stripReferenceContent,
} from './formatters.js';
describe('formatters', () => {
describe('formatMemoryUsage', () => {
describe('formatBytes', () => {
it('should format bytes into KB', () => {
expect(formatMemoryUsage(12345)).toBe('12.1 KB');
expect(formatBytes(12345)).toBe('12.1 KB');
});
it('should format bytes into MB', () => {
expect(formatMemoryUsage(12345678)).toBe('11.8 MB');
expect(formatBytes(12345678)).toBe('11.8 MB');
});
it('should format bytes into GB', () => {
expect(formatMemoryUsage(12345678901)).toBe('11.50 GB');
expect(formatBytes(12345678901)).toBe('11.50 GB');
});
});

View File

@@ -9,7 +9,7 @@ import {
REFERENCE_CONTENT_END,
} from '@google/gemini-cli-core';
export const formatMemoryUsage = (bytes: number): string => {
export const formatBytes = (bytes: number): string => {
const gb = bytes / (1024 * 1024 * 1024);
if (bytes < 1024 * 1024) {
return `${(bytes / 1024).toFixed(1)} KB`;