mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 00:21:09 -07:00
refactor: rename formatMemoryUsage to formatBytes (#14997)
Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user