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.
18 lines
660 B
TypeScript
18 lines
660 B
TypeScript
// vitest 单测:Receipt 类相关用例,断点可设在 receipt.ts 的方法里
|
|
import { describe, expect, it } from "vitest";
|
|
import { Receipt } from "../src/receipt";
|
|
import { createOrder } from "../src/orders";
|
|
|
|
describe("Receipt", () => {
|
|
it("lines() 返回订单每一行的描述", () => {
|
|
const order = createOrder([{ productId: "apple", quantity: 3 }]);
|
|
const receipt = new Receipt(order);
|
|
expect(receipt.lines()).toEqual(["Apple x3 $4.50"]);
|
|
});
|
|
|
|
it("total() 等于订单 total", () => {
|
|
const order = createOrder([{ productId: "bread", quantity: 1 }]);
|
|
expect(new Receipt(order).total()).toBe(order.total);
|
|
});
|
|
});
|