Files
awesome-reviewers/_reviewers/aws-sdk-js-follow-established-testing-patterns.md
2025-07-03 10:48:16 +03:00

1.6 KiB

title, description, repository, label, language, comments_count, repository_stars
title description repository label language comments_count repository_stars
Follow established testing patterns When writing tests, use existing patterns and infrastructure already established in the codebase rather than creating custom implementations. This improves consistency, reduces maintenance burden, and helps ensure comprehensive test coverage. aws/aws-sdk-js Testing Other 3 7628

When writing tests, use existing patterns and infrastructure already established in the codebase rather than creating custom implementations. This improves consistency, reduces maintenance burden, and helps ensure comprehensive test coverage.

For feature tests:

  • Identify common operations (like list/describe) that already have standard patterns
  • Reuse existing step definitions when possible

For unit tests:

  • Include tests for both positive and negative scenarios when features have toggles
  • When implementation changes affect tests, adapt tests to maintain their original intent rather than removing them

Example:

// GOOD: Using standard patterns for describe operations
Scenario: describe connections
  When I describe the connection
  Then I should get response of type "Array"

// INSTEAD OF: Creating custom step definitions
Scenario: Managing connections
  Given I create a Direct Connect connection with name prefix "aws-sdk-js"
  Then I should get a Direct Connect connection ID
  And I describe the connection
  ...

// GOOD: Testing both enabled and disabled states
it('translates empty strings when convertEmptyValues is true', -> ...)
it('does not translate empty strings when convertEmptyValues is false', -> ...)