-
-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Description
Current Coverage: 75.78%
Uncovered Lines and Missing Test Scenarios
Files references: src/models/XsdSchema.ts and test/processors/XsdInputProcessor.spec.ts
1. Simple Type Constraints
Lines: 201, 266–270, 277–281
Missing tests for:
- Simple content parsing (
parseSimpleContent) - Complex content with extensions (
parseComplexContent) - Simple type parsing within elements (
parseSimpleType)
Test files needed:
<!-- simple-content.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="PersonType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:int"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema><!-- complex-content.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ExtendedPerson">
<xs:complexContent>
<xs:extension base="xs:string">
<xs:sequence>
<xs:element name="address" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>2. Pattern and Length Constraints
Lines: 337–342, 349–365
Missing tests for:
- Pattern restrictions (
xs:pattern) - Minimum and maximum length constraints (
xs:minLength,xs:maxLength)
Test files needed:
<!-- pattern-restrictions.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="EmailType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PasswordType">
<xs:restriction base="xs:string">
<xs:minLength value="8"/>
<xs:maxLength value="128"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>3. Numeric Constraints
Lines: 369–389
Missing tests for:
- Inclusive constraints (
xs:minInclusive,xs:maxInclusive) - Exclusive constraints (
xs:minExclusive,xs:maxExclusive)
Test files needed:
<!-- numeric-constraints.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="AgeType">
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="150"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PercentageType">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>4. Attribute Parsing
Lines: 400–412
Missing tests for:
- Attributes with default values (
@_default) - Fixed attributes (
@_fixed) - Prohibited attributes (
use="prohibited")
Test files needed:
<!-- advanced-attributes.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ProductType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="status" type="xs:string" default="active"/>
<xs:attribute name="version" type="xs:string" fixed="1.0"/>
<xs:attribute name="deprecated" type="xs:boolean" use="prohibited"/>
</xs:complexType>
</xs:schema>Adding targeted tests for the above cases would significantly improve XSD coverage from ~75.78% to ~90%+
Steps to Reproduce:
npm run test:librarystart coverage/lcov-report/index.html- click on
src/modelsand navigate toXsdSchema.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels