-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
3a25a9e
commit 8aad7c1
Showing
5 changed files
with
132 additions
and
3 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
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
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 Type Tests - ImportDeclaration | ||
* @module esast/nodes/tests/unit-d/ImportDeclaration | ||
*/ | ||
|
||
import type { | ||
Data, | ||
ImportKind, | ||
ImportSpecifiers, | ||
Parent, | ||
StringLiteral | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../declaration-import' | ||
|
||
describe('unit-d:nodes/ImportDeclaration', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.ImportDeclarationData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [children: [ImportSpecifiers, StringLiteral]]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('children') | ||
.toEqualTypeOf<[ImportSpecifiers, StringLiteral]>() | ||
}) | ||
|
||
it('should match [data?: Optional<ImportDeclarationData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [kind: ImportKind]', () => { | ||
expectTypeOf<Subject>().toHaveProperty('kind').toEqualTypeOf<ImportKind>() | ||
}) | ||
|
||
it('should match [type: "importDeclaration"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'importDeclaration'>() | ||
}) | ||
|
||
describe('ImportDeclarationData', () => { | ||
it('should extend Data', () => { | ||
expectTypeOf<SubjectData>().toMatchTypeOf<Data>() | ||
}) | ||
}) | ||
}) |
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,60 @@ | ||
/** | ||
* @file Nodes - ImportDeclaration | ||
* @module esast/nodes/ImportDeclaration | ||
*/ | ||
|
||
import type { | ||
Data, | ||
ImportKind, | ||
ImportSpecifiers, | ||
Parent, | ||
StringLiteral | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `import` declarations. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface ImportDeclarationData extends Data {} | ||
|
||
/** | ||
* An `import` declaration. | ||
* | ||
* @see {@linkcode Parent} | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface ImportDeclaration extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode ImportSpecifiers} | ||
* @see {@linkcode StringLiteral} | ||
*/ | ||
children: [specifiers: ImportSpecifiers, source: StringLiteral] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode ImportDeclarationData} | ||
*/ | ||
data?: Optional<ImportDeclarationData> | ||
|
||
/** | ||
* Import kind. | ||
* | ||
* @see {@linkcode ImportKind} | ||
*/ | ||
kind: ImportKind | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'importDeclaration' | ||
} | ||
|
||
export type { ImportDeclarationData, ImportDeclaration 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