kakasoo / kakasoo/DeepStrictTypes
[TEST] Add dedicated tests for `ExpandGlob` type
- Dominant language
- TypeScript
- Stars
- 64
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
# Feature Request
- [x] Extensions of existing features
- [ ] Propose a type that didn't exist before
**Type Expectation**
There is no dedicated test file for `src/types/ExpandGlob.ts`. Currently it is only verified indirectly through `DeepStrictPick`'s glob tests, so dedicated tests are needed to directly verify `ExpandGlob`'s edge cases.
**Example Type**
```typescript
import { ExpandGlob, Equal } from '../../src';
// Basic: top-level glob
type Q1 = ExpandGlob<{ a: 1; b: 2; c: 3 }, "*">;
type A1 = Equal;
// Nested glob
type Q2 = ExpandGlob<{ a: { b: 1; c: 2 } }, "a.*">;
type A2 = Equal;
// Array inner glob
type Q3 = ExpandGlob<{ items: { id: number; name: string }[] }, "items[*].*">;
type A3 = Equal;
// Non-glob passthrough
type Q4 = ExpandGlob<{ a: { b: 1 } }, "a.b">;
type A4 = Equal;
```
**Proposed Solution**
Create a new `test/features/ExpandGlob.ts` file to test the following scenarios.
**Test Requirements**
All changes must include the following tests:
1. **Backward Compatibility**
- All existing tests must pass
- Add tests to verify that existing type behavior remains unchanged
2. **Feature Verification**
- `*` (top-level glob)
- `a.*` (nested glob)
- `a[*].*` (array inner glob)
- Non-glob regular key passthrough
- Mixed glob + regular key (when passed as union)
3. **Complex Type Stability**
- 3+ levels of nested glob (`a.b.*`)
- Array within array glob (`items[*].sub[*].*`)
- Glob applied to empty object
- Glob on objects with branded type properties
- Glob applied to tuple elements (`[{ a: 1 }, { b: 2 }]`)
- Glob applied to readonly arrays
**How to verify:**
```bash
npm run build:test && npm run test
npm run prettier
```
Contributor guide
Research direction
Start by reading src/types/ExpandGlob.ts and the existing DeepStrictPick glob tests, then create the proposed test/features/ExpandGlob.ts file. Cover the listed glob, array, nested, tuple, readonly, branded-property, empty-object, and passthrough cases. Run npm run build:test && npm run test, followed by npm run prettier; done means all existing and new tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100