Skip to content

feat: enhance test coverage with additional formatting cases#4

Merged
JoelMiller74 merged 3 commits intomainfrom
update-code-coverage
Dec 6, 2025
Merged

feat: enhance test coverage with additional formatting cases#4
JoelMiller74 merged 3 commits intomainfrom
update-code-coverage

Conversation

@JoelMiller74
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 6, 2025 20:30
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 enhances test coverage for the T-SQL formatter engine by adding 17 new test cases covering various formatting configurations. The tests verify formatter behavior for options like dense operators, parenthesis spacing, join alignment, logical operator positioning, alias keywords, CTE styles, window functions, column definition alignment, and bracket identifier handling.

Key Changes

  • Added comprehensive test coverage for configuration options previously untested in the Vitest suite
  • Tests validate edge cases and specific formatting behaviors for different config combinations

it('tabulate alias', () => {
const t = 'SELECT a AS alias, verylongcolumn AS longer FROM t';
const out = formatTsql(t, { options: {} as any, config: cfg({ newlineAfterSelect: true, tabulateAlias: true }), profile: {} });
expect(out).toBe('SELECT\n a AS alias, verylongcolumn AS longer\nFROM t');
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

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

The expected output appears to be incorrect. With newlineAfterSelect: true, the formatter puts each column on a separate line (joined with newlines on line 142 of engine.ts). The expected output should have each column on its own line, something like:

expect(/SELECT\n\s+a.*AS alias,?\n\s+verylongcolumn.*AS longer\nFROM/.test(out)).toBe(true);

Additionally, with tabulateAlias: true, the code adds padding to align the AS keywords, which is not reflected in the current expected value.

Suggested change
expect(out).toBe('SELECT\n a AS alias, verylongcolumn AS longer\nFROM t');
expect(/SELECT\n\s+a\s+AS alias,?\n\s+verylongcolumn\s+AS longer\nFROM t/.test(out)).toBe(true);

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JoelMiller74 JoelMiller74 merged commit dc33bac into main Dec 6, 2025
0 of 3 checks passed
@JoelMiller74 JoelMiller74 deleted the update-code-coverage branch December 6, 2025 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants