Files
vimx/training/tests/catalog.test.ts
T
fukunee 3ff24e1ed5 Streamline training tasks and add debugging guide
Reorganize the README checklist: fold the standalone
Ex-command task into earlier tasks, give the outline panel
its own bindings (g o / Ctrl+Shift+O), and add a dedicated
debugging task with breakpoint, stepping, and fault-finding
drills anchored to real lines in the training app.

Annotate the training app sources and tests with Chinese
practice hints (multi-cursor, macro, text-object, and
breakpoint spots).

Drop the redundant root tsconfig, since training/tsconfig.json
already covers src and tests, and remove the stale
LEADERBOARD.md left over from the deleted challenge mode.
2026-09-09 23:54:48 +08:00

15 lines
510 B
TypeScript

// vitest 单测:catalog 相关用例,练完 ga / 宏之后用 npm run test 验证
import { describe, expect, it } from "vitest";
import { PRODUCTS, findProduct } from "../src/catalog";
describe("catalog", () => {
it("findProduct 返回存在的商品", () => {
expect(findProduct("apple").name).toBe("Apple");
expect(PRODUCTS.length).toBeGreaterThanOrEqual(5);
});
it("findProduct 对未知商品抛错", () => {
expect(() => findProduct("rock")).toThrow(/Unknown product/);
});
});