dbml icon indicating copy to clipboard operation
dbml copied to clipboard

Add comprehensive parser tests

Open H-DNA opened this issue 2 months ago • 3 comments

Summary

  • Short summary of the task, what have been done etc
  • Please include screenshots whenever possible (important).

Issue

(issue link here)

Lasting Changes (Technical)

(please list down: code changes/things that have wide-effect; new libraries/functions added that can be used by others; examples below)

  • (Added class EmailValidator to validate email address' validity)
  • (Added Tenant#is_trial? check)

Checklist

Please check directly on the box once each of these are done

  • [ ] Documentation (if necessary)
  • [ ] Lint checks
  • [ ] Tests (integration test/unit test)
  • [ ] Integration Tests Passed
  • [ ] Code Review

H-DNA avatar Nov 17 '25 08:11 H-DNA

Could you add the description for the PR?

huyleminh01 avatar Nov 17 '25 08:11 huyleminh01

Could you add the description for the PR?

This one is still a work in progress... I'll add it once I'm done. For now I'll mark it as a draft!

H-DNA avatar Nov 17 '25 08:11 H-DNA

Coverage Report

Commit: b1861ec0

📊 View detailed HTML coverage reports

Overall Coverage

Metric Coverage
Lines ✅ 80.67% (6546/8115)
Statements ✅ 80.03% (6998/8744)
Functions ✅ 82.97% (1661/2002)
Branches ⚠️ 68.74% (3154/4588)

Package Coverage

Package Lines Statements Functions Branches
@dbml/dbml-cli ✅ 100.00% ✅ 100.00% ✅ 100.00% ✅ 100.00%
@dbml/dbml-connector ⚠️ 59.73% ⚠️ 59.70% ⚠️ 54.54% ⚠️ 55.69%
@dbml/dbml-core ✅ 90.83% ✅ 89.86% ✅ 91.10% ⚠️ 76.83%
@dbml/dbml-parse ⚠️ 75.71% ⚠️ 74.99% ⚠️ 78.51% ⚠️ 64.51%

⚠️ Coverage Warnings

The following packages have coverage below 80%:

  • @dbml/dbml-connector: 59.73% line coverage
  • @dbml/dbml-parse: 75.71% line coverage

Files with Coverage Below 80%

@dbml/dbml-connector

6 file(s) below 80% coverage
File Lines Statements Functions Branches
src/connectors/bigqueryConnector.ts 0.00% 0.00% 0.00% 0.00%
src/utils/credential-loader.ts 0.00% 0.00% 0.00% 0.00%
src/utils/helpers.ts 0.00% 0.00% 0.00% 0.00%
src/connectors/snowflakeConnector.ts 10.56% 10.31% 0.00% 0.00%
src/utils/parseSchema.ts 46.15% 42.85% 28.57% 27.27%
src/connectors/connector.ts 62.50% 62.50% 100.00% 50.00%

@dbml/dbml-core

30 file(s) below 80% coverage
File Lines Statements Functions Branches
src/parse/error.js 0.00% 0.00% 0.00% 0.00%
src/parse/ANTLR/ASTGeneration/SyntaxError.js 0.00% 0.00% 0.00% 0.00%
src/utils/version.js 0.00% 0.00% 100.00% 100.00%
src/model_structure/element.js 16.66% 16.66% 25.00% 0.00%
src/parse/databaseGenerator.js 18.42% 17.94% 0.00% 0.00%
src/import/index.js 50.00% 50.00% 50.00% 100.00%
src/model_structure/utils.js 50.00% 50.00% 50.00% 0.00%
src/export/JsonExporter.js 66.66% 66.66% 100.00% 33.33%
src/parse/ANTLR/ASTGeneration/ParserErrorListener.js 66.66% 66.66% 50.00% 100.00%
src/parse/Parser.js 67.30% 64.81% 62.50% 61.90%
src/export/utils.js 73.17% 73.80% 90.00% 54.54%
src/model_structure/schema.js 76.11% 78.94% 86.04% 32.35%
src/model_structure/tableGroup.js 80.64% 81.25% 80.00% 38.09%
src/export/ModelExporter.js 82.35% 82.35% 100.00% 58.33%
src/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.js 84.30% 82.50% 91.56% 68.69%
src/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js 85.02% 83.12% 90.81% 66.38%
src/model_structure/enum.js 90.90% 91.66% 100.00% 33.33%
src/parse/ANTLR/ASTGeneration/AST.js 91.11% 91.11% 76.47% 77.77%
src/model_structure/check.js 92.30% 92.30% 83.33% 66.66%
src/model_structure/endpoint.js 92.85% 94.00% 100.00% 65.38%
src/model_structure/enumValue.js 92.85% 92.85% 100.00% 75.00%
src/model_structure/tablePartial.js 92.85% 92.85% 80.00% 77.77%
src/model_structure/ref.js 93.33% 93.54% 100.00% 69.23%
src/model_structure/table.js 94.25% 91.91% 97.67% 61.01%
src/model_structure/indexes.js 96.55% 96.77% 100.00% 72.72%
src/parse/ANTLR/ASTGeneration/index.js 98.21% 90.16% 100.00% 62.50%
src/model_structure/stickyNote.js 100.00% 100.00% 100.00% 0.00%
src/parse/ANTLR/ASTGeneration/helpers.js 100.00% 83.33% 100.00% 75.00%
src/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js 100.00% 100.00% 40.00% 100.00%
src/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js 100.00% 100.00% 0.00% 100.00%

@dbml/dbml-parse

31 file(s) below 80% coverage
File Lines Statements Functions Branches
src/services/utils.ts 0.00% 0.00% 0.00% 100.00%
src/services/definition/provider.ts 0.00% 0.00% 0.00% 0.00%
src/services/references/provider.ts 0.00% 0.00% 0.00% 0.00%
src/services/suggestions/provider.ts 0.00% 0.00% 0.00% 0.00%
src/services/suggestions/utils.ts 0.00% 0.00% 0.00% 0.00%
src/compiler.ts 16.75% 16.93% 5.40% 3.88%
src/lib/analyzer/symbol/utils.ts 25.00% 40.00% 33.33% 50.00%
src/lib/parser/utils.ts 45.13% 45.27% 82.35% 51.49%
src/lib/interpreter/elementInterpreter/project.ts 51.42% 51.42% 100.00% 36.36%
src/lib/utils.ts 51.85% 51.72% 60.00% 53.84%
src/lib/analyzer/validator/elementValidators/indexes.ts 64.00% 60.49% 72.72% 46.15%
src/lib/analyzer/validator/elementValidators/custom.ts 69.23% 66.66% 87.50% 55.55%
src/lib/analyzer/validator/elementValidators/note.ts 72.54% 70.90% 76.92% 68.75%
src/lib/analyzer/validator/elementValidators/checks.ts 74.07% 75.86% 93.75% 65.62%
src/lib/option.ts 75.00% 75.00% 75.00% 100.00%
src/lib/analyzer/analyzer.ts 75.00% 66.66% 60.00% 100.00%
src/lib/analyzer/validator/elementValidators/project.ts 75.00% 75.75% 90.90% 56.25%
src/lib/analyzer/validator/elementValidators/tablePartial.ts 76.33% 69.27% 68.08% 55.19%
src/lib/analyzer/validator/elementValidators/ref.ts 76.82% 75.00% 80.95% 75.80%
src/lib/parser/parser.ts 79.54% 79.59% 94.11% 71.76%
src/lib/interpreter/elementInterpreter/tablePartial.ts 81.51% 80.64% 84.00% 75.00%
src/lib/analyzer/validator/elementValidators/table.ts 83.16% 80.26% 78.84% 69.27%
src/lib/analyzer/utils.ts 83.51% 82.79% 94.11% 78.66%
src/lib/analyzer/validator/elementValidators/enum.ts 83.72% 82.22% 84.21% 78.26%
src/lib/interpreter/utils.ts 83.72% 85.41% 95.83% 77.04%
__tests__/properties/utils.ts 89.36% 87.87% 100.00% 67.74%
src/lib/analyzer/validator/elementValidators/tableGroup.ts 90.12% 88.88% 91.66% 73.33%
src/lib/analyzer/symbol/symbolIndex.ts 91.30% 87.75% 100.00% 65.21%
src/lib/analyzer/validator/validator.ts 94.11% 89.47% 80.00% 75.00%
src/lib/interpreter/elementInterpreter/sticky_note.ts 95.00% 95.23% 100.00% 66.66%
src/lib/analyzer/symbol/symbolTable.ts 100.00% 100.00% 100.00% 75.00%

github-actions[bot] avatar Nov 19 '25 18:11 github-actions[bot]