-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
78a4cbd
commit 50a80ee
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @file Unit Tests - DependencyMap | ||
* @module pkg-types/types/tests/DependencyMap | ||
*/ | ||
|
||
import type { DependencyMeta, PeerDependencyMeta } from '#src/interfaces' | ||
import pkg from '../../../package.json' assert { type: 'json' } | ||
import type TestSubject from '../dependency-map' | ||
|
||
describe('unit:types/DependencyMap', () => { | ||
it('should allow dependency map', () => { | ||
assertType<TestSubject<string>>(pkg.devDependencies) | ||
}) | ||
|
||
it('should allow dependency for browsers', () => { | ||
assertType<TestSubject<string | false>>({ | ||
fs: false, | ||
path: './dist/browser-shims/path.mjs' | ||
}) | ||
}) | ||
|
||
it('should allow dependency metadata map', () => { | ||
assertType<TestSubject<DependencyMeta>>({ | ||
fsevents: { built: false, optional: false, unplugged: true } | ||
}) | ||
}) | ||
|
||
it('should allow peer dependency metadata map', () => { | ||
assertType<TestSubject<PeerDependencyMeta>>({ | ||
'@flex-development/tutils': { optional: false } | ||
}) | ||
}) | ||
|
||
it('should allow empty object', () => { | ||
// Arrange | ||
type T = DependencyMeta | PeerDependencyMeta | string | false | ||
|
||
// Expect | ||
assertType<TestSubject<T>>({}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @file Type Definitions - DependencyMap | ||
* @module pkg-types/types/DependencyMap | ||
*/ | ||
|
||
import type { DependencyMeta, PeerDependencyMeta } from '#src/interfaces' | ||
|
||
/** | ||
* Maps dependency names to version ranges, files, or metadata. | ||
* | ||
* @template T - Version range, file, or metadata type | ||
*/ | ||
type DependencyMap< | ||
T extends DependencyMeta | PeerDependencyMeta | string | false | ||
> = Partial<Record<string, T>> | ||
|
||
export type { DependencyMap as default } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters