Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -3,55 +3,51 @@
|
||||
// Authors:
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
sortNumEngZhtw,
|
||||
sortNumEngZhtwForFilter,
|
||||
} from '@/module/sortNumEngZhtw.js';
|
||||
} from "@/module/sortNumEngZhtw.js";
|
||||
|
||||
describe('sortNumEngZhtw', () => {
|
||||
it('sorts numbers in ascending order', () => {
|
||||
expect(sortNumEngZhtw(['3', '1', '2']))
|
||||
.toEqual(['1', '2', '3']);
|
||||
describe("sortNumEngZhtw", () => {
|
||||
it("sorts numbers in ascending order", () => {
|
||||
expect(sortNumEngZhtw(["3", "1", "2"])).toEqual(["1", "2", "3"]);
|
||||
});
|
||||
|
||||
it('places numbers before strings', () => {
|
||||
expect(sortNumEngZhtw(['b', '1', 'a']))
|
||||
.toEqual(['1', 'a', 'b']);
|
||||
it("places numbers before strings", () => {
|
||||
expect(sortNumEngZhtw(["b", "1", "a"])).toEqual(["1", "a", "b"]);
|
||||
});
|
||||
|
||||
it('sorts English strings alphabetically', () => {
|
||||
expect(sortNumEngZhtw(['cherry', 'apple', 'banana']))
|
||||
.toEqual(['apple', 'banana', 'cherry']);
|
||||
it("sorts English strings alphabetically", () => {
|
||||
expect(sortNumEngZhtw(["cherry", "apple", "banana"])).toEqual([
|
||||
"apple",
|
||||
"banana",
|
||||
"cherry",
|
||||
]);
|
||||
});
|
||||
|
||||
it('sorts mixed numbers and strings', () => {
|
||||
const input = ['banana', '10', 'apple', '2'];
|
||||
it("sorts mixed numbers and strings", () => {
|
||||
const input = ["banana", "10", "apple", "2"];
|
||||
const result = sortNumEngZhtw(input);
|
||||
expect(result).toEqual(['2', '10', 'apple', 'banana']);
|
||||
expect(result).toEqual(["2", "10", "apple", "banana"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sortNumEngZhtwForFilter', () => {
|
||||
it('returns negative when a < b (numbers)', () => {
|
||||
expect(sortNumEngZhtwForFilter('1', '2'))
|
||||
.toBeLessThan(0);
|
||||
describe("sortNumEngZhtwForFilter", () => {
|
||||
it("returns negative when a < b (numbers)", () => {
|
||||
expect(sortNumEngZhtwForFilter("1", "2")).toBeLessThan(0);
|
||||
});
|
||||
|
||||
it('returns positive when a > b (numbers)', () => {
|
||||
expect(sortNumEngZhtwForFilter('10', '2'))
|
||||
.toBeGreaterThan(0);
|
||||
it("returns positive when a > b (numbers)", () => {
|
||||
expect(sortNumEngZhtwForFilter("10", "2")).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('places numbers before strings', () => {
|
||||
expect(sortNumEngZhtwForFilter('1', 'a'))
|
||||
.toBeLessThan(0);
|
||||
expect(sortNumEngZhtwForFilter('a', '1'))
|
||||
.toBeGreaterThan(0);
|
||||
it("places numbers before strings", () => {
|
||||
expect(sortNumEngZhtwForFilter("1", "a")).toBeLessThan(0);
|
||||
expect(sortNumEngZhtwForFilter("a", "1")).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('compares strings using locale', () => {
|
||||
expect(sortNumEngZhtwForFilter('a', 'b'))
|
||||
.toBeLessThan(0);
|
||||
it("compares strings using locale", () => {
|
||||
expect(sortNumEngZhtwForFilter("a", "b")).toBeLessThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user