house-rules

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

House rules

团队规范

Write the code, and everything that describes it, with the
writing-lean
skill.
  • Test our code, not the dependency. Test the behaviour our code adds, and take the package as given: import its values rather than copying its tables, and leave its behaviour to its own tests.
  • Single source of truth. Take each value from where it is defined: the Tailwind scale (
    max-w-7xl
    , not
    max-w-[1468px]
    ), a shared constant, or the package's own types.
  • Spec style. Set up and tear down in the test framework's hooks. Arrange, act, then assert, and assert the whole result, so an extra item fails the test.
  • Fake the clock whenever a spec depends on the time, so it passes at any hour and in any time zone.
使用
writing-lean
skill 编写代码以及所有用于描述代码的内容。
  • 测试我们的代码,而不是依赖项。 测试我们的代码所增加的行为,并将依赖的 package 视为既定条件:导入它的值,而不是复制它的表格,并将它的行为交由它自己的测试验证。
  • 单一事实来源。 每个值都应取自其定义位置:Tailwind 尺度(
    max-w-7xl
    ,而不是
    max-w-[1468px]
    )、共享常量,或 package 自身的类型。
  • Spec 风格。 在测试框架的 hooks 中完成 setup 和 teardown。按照 arrange、act、assert 的顺序执行,并对整个结果进行断言,这样多出一个条目也会导致测试失败。
  • 当 spec 依赖时间时,使用假时钟,确保测试在任何时间点和时区都能通过。