AgentSkillsCN

Jest Utility Test Skill

自动为代码库中的实用程序或辅助函数生成 Jest 测试用例。

SKILL.md
--- frontmatter
name: Jest Utility Test Skill
description: Automatically generate Jest test cases for utility or helper functions in the codebase.

Jest Utility Test Skill

Whenever Copilot encounters a utility or helper function (e.g., string manipulation, math operations, data formatting), it should generate a corresponding Jest test file.

  • Place the test file alongside the utility in the same folder, named <filename>.test.js.
  • Ensure tests cover normal cases, edge cases, and error handling.
  • Use describe blocks for grouping and test blocks for individual cases.
  • Keep tests concise, readable, and aligned with Jest best practices.
  • If the function throws errors, include toThrow assertions.
  • If the function handles arrays or objects, include tests for empty and malformed inputs.
  • Include atleast one edge case.
  • For number inputs, test with value -1, 0, undefined. Update function if these edge cases are not handled.