Replace the old exercise files (challenges, maze, sandbox, etc.) with a runnable order/inventory TypeScript app under training/ that ships with unit tests, typecheck, lint, and format scripts. Merge the full task checklist from TRAINING.md into README.md and drop the obsolete docs and challenge files. Add a root .gitignore for .zed, .reasonix, and build artifacts, untrack the previously committed local configs, and fix the root tsconfig to point at the new training sources.
14 lines
423 B
TypeScript
14 lines
423 B
TypeScript
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/);
|
|
});
|
|
});
|