uuid: - value: 0a3c28cf-0365-40a7-bc3d-074e90bb28ce langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:32+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: | A lack of tests discourages refactoring created: - value: '2023-09-09T00:00:00+00:00' changed: - value: '2025-05-11T09:00:32+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2023/09/09/a-lack-of-tests-discourages-refactoring langcode: en body: - value: |

A common cause of not refactoring code is a lack of test coverage.

Why change some code if it works? What if we break it whilst refactoring it and introduce a regression?

If the code has accompanying automated tests, this can't happen.

The tests should be passing before starting a refactor and should be passing once the refactor is complete.

If the tests fail, the refactor was unsuccessful and should be reverted.

If you have a CI pipeline, a failing test should break the pipeline and prevent any further steps if you're doing continuous delivery or deployment whilst signalling to the Developer their refactor was unsuccessful and the pipeline needs to be fixed.

Without tests, the code could be broken during the refactor, and we wouldn't know.

format: full_html processed: |

A common cause of not refactoring code is a lack of test coverage.

Why change some code if it works? What if we break it whilst refactoring it and introduce a regression?

If the code has accompanying automated tests, this can't happen.

The tests should be passing before starting a refactor and should be passing once the refactor is complete.

If the tests fail, the refactor was unsuccessful and should be reverted.

If you have a CI pipeline, a failing test should break the pipeline and prevent any further steps if you're doing continuous delivery or deployment whilst signalling to the Developer their refactor was unsuccessful and the pipeline needs to be fixed.

Without tests, the code could be broken during the refactor, and we wouldn't know.

summary: null field_daily_email_cta: { }