-
-
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
ab8a328
commit 0387945
Showing
3 changed files
with
108 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,56 @@ | ||
/** | ||
* @file Unit Tests - Directories | ||
* @module pkg-types/interfaces/tests/Directories | ||
*/ | ||
|
||
import type TestSubject from '../directories' | ||
|
||
describe('unit:interfaces/Directories', () => { | ||
it('should allow empty object', () => { | ||
assertType<TestSubject>({}) | ||
}) | ||
|
||
it('should allow object that only has property "bin"', () => { | ||
assertType<TestSubject>({ bin: './dist/bin' }) | ||
}) | ||
|
||
it('should allow object that only has property "doc"', () => { | ||
assertType<TestSubject>({ doc: './dist/docs' }) | ||
}) | ||
|
||
it('should allow object that only has property "example"', () => { | ||
assertType<TestSubject>({ example: './dist/docs/examples' }) | ||
}) | ||
|
||
it('should allow object that only has property "lib"', () => { | ||
assertType<TestSubject>({ lib: './dist/lib' }) | ||
}) | ||
|
||
it('should allow object that only has property "man"', () => { | ||
assertType<TestSubject>({ man: './dist/man' }) | ||
}) | ||
|
||
it('should allow object that only has property "src"', () => { | ||
assertType<TestSubject>({ src: './src' }) | ||
}) | ||
|
||
it('should allow object that only has property "test"', () => { | ||
assertType<TestSubject>({ test: './__tests__' }) | ||
}) | ||
|
||
it('should allow object with all properties', () => { | ||
assertType<Required<TestSubject>>({ | ||
bin: './dist/bin', | ||
doc: './dist/docs', | ||
example: './dist/docs/examples', | ||
lib: './dist/lib', | ||
man: './dist/man', | ||
src: './src', | ||
test: './__tests__' | ||
}) | ||
}) | ||
|
||
it('should allow object with unknown key', () => { | ||
assertType<TestSubject>({ jars: 'java' }) | ||
}) | ||
}) |
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,51 @@ | ||
/** | ||
* @file Interfaces - Directories | ||
* @module pkg-types/interfaces/Directories | ||
*/ | ||
|
||
/** | ||
* Package structure indicator. | ||
* | ||
* @see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directories | ||
* @see https://wiki.commonjs.org/wiki/Packages/1.0#Package_Directory_Layout | ||
*/ | ||
interface Directories { | ||
[type: string]: string | ||
|
||
/** | ||
* Relative path to directory containing executable files. | ||
*/ | ||
bin?: string | ||
|
||
/** | ||
* Relative path to directory containing documentation. | ||
*/ | ||
doc?: string | ||
|
||
/** | ||
* Relative path to directory containing package usage examples. | ||
*/ | ||
example?: string | ||
|
||
/** | ||
* Relative path to directory containing distribution code. | ||
*/ | ||
lib?: string | ||
|
||
/** | ||
* Relative path to directory containing man pages. | ||
*/ | ||
man?: string | ||
|
||
/** | ||
* Relative path to directory containing source code. | ||
*/ | ||
src?: string | ||
|
||
/** | ||
* Relative path to directory containing test files. | ||
*/ | ||
test?: string | ||
} | ||
|
||
export type { Directories 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