feat: 新增 target description 字段,收紧 id/name 长度,调整延迟列和名称列
This commit is contained in:
@@ -2,16 +2,12 @@ import { describe, expect, test } from "bun:test";
|
||||
|
||||
import type { TargetStatus } from "../../../src/shared/api";
|
||||
|
||||
import {
|
||||
availabilitySorter,
|
||||
latencySorter,
|
||||
nameSorter,
|
||||
statusSorter,
|
||||
} from "../../../src/web/constants/target-table-sorters";
|
||||
import { availabilitySorter, latencySorter, statusSorter } from "../../../src/web/constants/target-table-sorters";
|
||||
|
||||
function makeTarget(overrides: Partial<TargetStatus> = {}): TargetStatus {
|
||||
return {
|
||||
currentStreak: null,
|
||||
description: null,
|
||||
group: "default",
|
||||
id: "1",
|
||||
interval: "5s",
|
||||
@@ -97,18 +93,3 @@ describe("latencySorter", () => {
|
||||
expect(latencySorter(noLatency, hasLatency)).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("nameSorter", () => {
|
||||
test("按名称字母排序", () => {
|
||||
const a = makeTarget({ name: "Alpha" });
|
||||
const b = makeTarget({ name: "Beta" });
|
||||
expect(nameSorter(a, b)).toBeLessThan(0);
|
||||
});
|
||||
|
||||
test("中文名称排序", () => {
|
||||
const a = makeTarget({ name: "百度" });
|
||||
const b = makeTarget({ name: "谷歌" });
|
||||
const result = nameSorter(a, b);
|
||||
expect(typeof result).toBe("number");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user