Skip to content

test: add comprehensive TypeScript code extraction tests#1211

Merged
misrasaurabh1 merged 2 commits intomainfrom
test/typescript-code-extraction-validation
Jan 31, 2026
Merged

test: add comprehensive TypeScript code extraction tests#1211
misrasaurabh1 merged 2 commits intomainfrom
test/typescript-code-extraction-validation

Conversation

@misrasaurabh1
Copy link
Contributor

Summary

  • Add comprehensive unit tests for TypeScript code extraction
  • Verify that extracted TypeScript code is syntactically valid according to tree-sitter
  • Test various TypeScript constructs including async functions, template literals, try-catch blocks

Context

While investigating issues where the API server returned "Invalid TypeScript: Invalid syntax" errors, we discovered that the local tree-sitter validation correctly validates the extracted code. This test suite documents the expected behavior and helps catch any regression in code extraction.

Test Coverage

The new tests cover:

  • Syntax Validation: Basic functions, async functions, template literals, try-catch blocks, class methods
  • Code Extraction: Simple functions, async functions with template literals, complex try-catch blocks
  • Context Handling: Import statement preservation, global variable inclusion
  • Language Properties: TypeScript language identification, file extensions, test file suffix

Test plan

  • All 14 new tests pass
  • Tests verify extracted code is syntactically valid
  • Tests cover various TypeScript constructs that were reported as problematic

🤖 Generated with Claude Code

misrasaurabh1 and others added 2 commits January 30, 2026 23:42
Add tests to verify that TypeScript code extraction works correctly and
that extracted code is syntactically valid. These tests cover:

- Basic TypeScript syntax validation (functions, classes, async functions)
- Template literal handling
- Try-catch block extraction
- Import statement preservation
- Global variable inclusion
- TypeScript language support properties

These tests help catch issues where the code extraction might produce
syntactically invalid TypeScript that would be rejected by stricter
TypeScript parsers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@misrasaurabh1 misrasaurabh1 merged commit bd995c5 into main Jan 31, 2026
25 of 26 checks passed
@misrasaurabh1 misrasaurabh1 deleted the test/typescript-code-extraction-validation branch January 31, 2026 00:33
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.

1 participant