Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -3,39 +3,38 @@
|
||||
// Authors:
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import shortScaleNumber from '@/module/shortScaleNumber.js';
|
||||
import { describe, it, expect } from "vitest";
|
||||
import shortScaleNumber from "@/module/shortScaleNumber.js";
|
||||
|
||||
describe('shortScaleNumber', () => {
|
||||
it('returns small numbers without abbreviation', () => {
|
||||
expect(shortScaleNumber(1).trim()).toBe('1');
|
||||
expect(shortScaleNumber(999).trim()).toBe('999');
|
||||
describe("shortScaleNumber", () => {
|
||||
it("returns small numbers without abbreviation", () => {
|
||||
expect(shortScaleNumber(1).trim()).toBe("1");
|
||||
expect(shortScaleNumber(999).trim()).toBe("999");
|
||||
});
|
||||
|
||||
it('abbreviates thousands as k', () => {
|
||||
expect(shortScaleNumber(1000).trim()).toBe('1k');
|
||||
expect(shortScaleNumber(1500).trim()).toBe('1.5k');
|
||||
it("abbreviates thousands as k", () => {
|
||||
expect(shortScaleNumber(1000).trim()).toBe("1k");
|
||||
expect(shortScaleNumber(1500).trim()).toBe("1.5k");
|
||||
});
|
||||
|
||||
it('abbreviates millions as m', () => {
|
||||
expect(shortScaleNumber(1000000).trim()).toBe('1m');
|
||||
it("abbreviates millions as m", () => {
|
||||
expect(shortScaleNumber(1000000).trim()).toBe("1m");
|
||||
});
|
||||
|
||||
it('abbreviates billions as b', () => {
|
||||
expect(shortScaleNumber(1000000000).trim()).toBe('1b');
|
||||
it("abbreviates billions as b", () => {
|
||||
expect(shortScaleNumber(1000000000).trim()).toBe("1b");
|
||||
});
|
||||
|
||||
it('abbreviates trillions as t', () => {
|
||||
expect(shortScaleNumber(1000000000000).trim())
|
||||
.toBe('1t');
|
||||
it("abbreviates trillions as t", () => {
|
||||
expect(shortScaleNumber(1000000000000).trim()).toBe("1t");
|
||||
});
|
||||
|
||||
it('rounds up using Math.ceil', () => {
|
||||
it("rounds up using Math.ceil", () => {
|
||||
// 1234 -> 1.234k -> ceil(12.34)/10 = 1.3k
|
||||
expect(shortScaleNumber(1234).trim()).toBe('1.3k');
|
||||
expect(shortScaleNumber(1234).trim()).toBe("1.3k");
|
||||
});
|
||||
|
||||
it('handles zero', () => {
|
||||
expect(shortScaleNumber(0).trim()).toBe('0');
|
||||
it("handles zero", () => {
|
||||
expect(shortScaleNumber(0).trim()).toBe("0");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user