mvp-ai's picture
download
raw
1.04 kB
/**
* Unit tests for lists.ts
* Run with: bun test lib/lists.test.ts
*/
import { describe, expect, test } from "bun:test";
import { isLikelyUserId, parseCommonFlags } from "./lists";
describe("lists flag parsing", () => {
test("uses defaults when no flags are provided", () => {
const parsed = parseCommonFlags([]);
expect(parsed.json).toBe(false);
expect(parsed.limit).toBe(50);
});
test("parses json and limit flags", () => {
const parsed = parseCommonFlags(["--json", "--limit", "15"]);
expect(parsed.json).toBe(true);
expect(parsed.limit).toBe(15);
});
test("clamps limit to at least 1", () => {
const parsed = parseCommonFlags(["--limit", "0"]);
expect(parsed.limit).toBe(1);
});
});
describe("list member user identifier detection", () => {
test("accepts numeric IDs", () => {
expect(isLikelyUserId("2244994945")).toBe(true);
});
test("rejects usernames", () => {
expect(isLikelyUserId("jack")).toBe(false);
expect(isLikelyUserId("@jack")).toBe(false);
});
});

Xet Storage Details

Size:
1.04 kB
·
Xet hash:
c0fc7667119ae2d876c6e154741694763cc13e9e51e1b63797be428314ae0f7e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.