Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 946 Bytes

aaa-comments.md

File metadata and controls

39 lines (26 loc) · 946 Bytes

Enforce AAA comments (testing/aaa-comments)

💼⚠️ This rule is enabled in the ✅ recommended config. This rule warns in the 🌐 all config.

Rule Details

This rule aims to enforce AAA comments.

AAA stands for Arrange, Act, Assert. It is a pattern for structuring tests.

Examples of incorrect code for this rule:

test('foo', () => {
  expect(sum(1, 2)).toBe(3);
})

Examples of correct code for this rule:

test('foo', () => {
  // Arrange
  const num1 = 1;
  const num2 = 2;
  
  // Act
  const result = sum(num1, num2);

  // Assert
  expect(result).toBe(3);
})

Further Reading