用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill jest-testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | jest-testing |
| description | Use when writing Jest tests - covers testing patterns for interpreters, parsers, and async code |
| metadata | {"author":"ForceInjection"} |
import { run } from "../src/api";
describe("interpreter", () => {
it("evaluates arithmetic expressions", () => {
expect(run("2 + 3")).toBe(5);
});
it("handles errors gracefully", () => {
expect(() => run("undefined_var")).toThrow(/undefined/i);
});
});
describe("builtins", () => {
describe("map", () => {
it("transforms each element", () => {
const code = `[1, 2, 3] /> map((x) -> x * 2)`;
expect(run(code)).toEqual([2, 4, 6]);
});
it("passes index as second argument", () => {
const code = `["a", "b"] /> map((x, i) -> i)`;
expect(run(code)).toEqual([0, 1]);
});
});
});
describe("parser", () => {
it("parses pipe expressions", () => {
const ast = parse("x /> fn");
expect(ast.body[0]).toMatchObject({
type: "ExprStmt",
expression: {
type: "PipeExpr",
left: { type: "Identifier", name: "x" },
right: { type: "Identifier", name: "fn" }
}
});
});
});
it("resolves async operations", async () => {
const result = await run(`
let fetch = () -> delay(10) /> then(() -> "done") #async
await fetch()
`);
expect(result).toBe("done");
});
it("formats code consistently", () => {
const formatted = format("let x=1+2");
expect(formatted).toMatchSnapshot();
});
// jest.config.js
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/__tests__/**/*.test.ts"],
collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts"],
};
Source: ForceInjection/domain-driven-design-skills — distributed by TomeVault.