Skip to content

[jsweep] Clean is_truthy.test.cjs#15858

Merged
pelikhan merged 1 commit intomainfrom
jsweep-clean-is_truthy-9f0b921c70ec5b70
Feb 15, 2026
Merged

[jsweep] Clean is_truthy.test.cjs#15858
pelikhan merged 1 commit intomainfrom
jsweep-clean-is_truthy-9f0b921c70ec5b70

Conversation

@github-actions
Copy link
Contributor

Summary

Modernized and cleaned the test file for is_truthy.cjs to improve code quality and readability.

Changes Made

Code Quality Improvements

  • Replaced obfuscated boolean values: Changed !1 and !0 to proper false and true literals for clarity
  • Removed weird syntax patterns: Eliminated unnecessary parentheses and comma operators that made tests hard to read
  • Improved test structure: Each assertion is now on its own line for better readability
  • Enhanced test descriptions: Added contextual information (e.g., "case-insensitive") to test names

Test Coverage

  • All 10 tests passing - comprehensive coverage maintained
  • Tests cover: empty strings, falsy values ("false", "0", "null", "undefined"), truthy values, whitespace trimming, numeric strings, and case-insensitive handling
  • No logic changes - only code quality improvements

Execution Context

  • Context: Pure Node.js (not github-script)
  • File type: Test file for utility function

Validation Results

All validation checks passed successfully:

Check Command Result
✅ Formatting npm run format:cjs Passed
✅ Linting npm run lint:cjs Passed
✅ Type checking npm run typecheck Passed (no type errors)
✅ Tests npm run test:js -- is_truthy.test.cjs 10/10 tests passed

Before/After Example

Before (obfuscated and hard to read):

test('should return false for "false"', () => {
  (expect(isTruthy("false")).toBe(!1), expect(isTruthy("FALSE")).toBe(!1));
}),

After (clean and readable):

it('should return false for "false" (case-insensitive)', () => {
  expect(isTruthy("false")).toBe(false);
  expect(isTruthy("FALSE")).toBe(false);
  expect(isTruthy("False")).toBe(false);
});

Impact

  • Zero functional changes - all behavior preserved
  • Improved maintainability - code is now easier to read and modify
  • Better test clarity - assertions are clear and well-structured

AI generated by jsweep - JavaScript Unbloater

  • expires on Feb 17, 2026, 3:18 AM UTC

Modernize and clean test file for is_truthy:
- Remove weird parenthesis patterns and comma operators
- Improve test descriptions with context
- Properly structure assertions (one assertion per line)
- Maintain 10 comprehensive test cases covering all edge cases

Test improvements:
- All 10 tests passing ✓
- Better readability and maintainability
- No logic changes, only code quality improvements

Validation checks passed:
✓ Formatting: npm run format:cjs
✓ Linting: npm run lint:cjs
✓ Type checking: npm run typecheck
✓ Tests: npm run test:js -- is_truthy.test.cjs (10/10 passed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review February 15, 2026 03:38
Copilot AI review requested due to automatic review settings February 15, 2026 03:39
@pelikhan pelikhan merged commit 56e1ce9 into main Feb 15, 2026
2 checks passed
@pelikhan pelikhan deleted the jsweep-clean-is_truthy-9f0b921c70ec5b70 branch February 15, 2026 03:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes actions/setup/js/is_truthy.test.cjs to make the isTruthy unit tests clearer and easier to maintain, without changing test coverage or behavior.

Changes:

  • Replaced boolean obfuscations (!0/!1) with explicit true/false literals.
  • Removed comma-operator patterns and reformatted tests so each assertion is on its own line.
  • Improved test names to better describe intent (e.g., noting case-insensitive behavior).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments