Skip to content

Commit 775e5a1

Browse files
committed
feat(unit): export base type abstractions
Export Mocked<T> and Stub types from @suites/unit to establish the abstraction layer of the abstraction/augmentation pattern. These base types provide graceful fallback when adapter packages are not configured, and serve as the foundation that adapter packages will augment with library-specific implementations.
1 parent 93ba3bb commit 775e5a1

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

packages/unit/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
export { TestBed } from './testbed';
2-
export type { UnitTestBed, TestBedBuilder } from './types';
32
export type {
4-
UnitReference,
5-
MockOverride,
3+
UnitTestBed,
4+
TestBedBuilder,
5+
Mocked,
66
SolitaryTestBedBuilder,
77
SociableTestBedBuilder,
8-
} from '@suites/core.unit';
8+
} from './types';
9+
export type { UnitReference, MockOverride } from '@suites/core.unit';
10+
export type { Stub } from '@suites/types.doubles';

packages/unit/src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ import type {
88
MockOverride as MockOverrideCore,
99
} from '@suites/core.unit';
1010

11+
/**
12+
* Base abstract type for mocked instances. Adapters can augment this with
13+
* library-specific implementations (Jest, Vitest, Sinon) via module augmentation.
14+
*
15+
* @template T The type being mocked
16+
* @since 3.1.0
17+
*/
18+
export type Mocked<T> = StubbedInstance<T>;
19+
1120
export interface SociableTestBedBuilder<TClass> extends SociableTestBedBuilderCore<TClass> {
1221
/**
1322
* Exposes a dependency to be included in the test environment in its real or partially mocked state.

0 commit comments

Comments
 (0)