-
-
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
2c0b95a
commit 8cb7e57
Showing
3 changed files
with
97 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,47 @@ | ||
/** | ||
* @file Type Tests - Identifier | ||
* @module esast/nodes/tests/unit-d/Identifier | ||
*/ | ||
|
||
import type { Data, Node } from '@flex-development/esast' | ||
import type { Nilable, Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../identifier' | ||
|
||
describe('unit-d:nodes/Identifier', () => { | ||
type Identifier = TestSubject.default | ||
type IdentifierData = TestSubject.IdentifierData | ||
|
||
it('should extend Node', () => { | ||
expectTypeOf<Identifier>().toMatchTypeOf<Node>() | ||
}) | ||
|
||
it('should match [data?: Optional<IdentifierData>]', () => { | ||
expectTypeOf<Identifier>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<IdentifierData>>() | ||
}) | ||
|
||
it('should match [name: string]', () => { | ||
expectTypeOf<Identifier>() | ||
.toHaveProperty('name') | ||
.toEqualTypeOf<string>() | ||
}) | ||
|
||
it('should match [type: "identifier"]', () => { | ||
expectTypeOf<Identifier>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'identifier'>() | ||
}) | ||
|
||
describe('IdentifierData', () => { | ||
it('should extend Data', () => { | ||
expectTypeOf<IdentifierData>().toMatchTypeOf<Data>() | ||
}) | ||
|
||
it('should match [private?: Nilable<boolean>]', () => { | ||
expectTypeOf<IdentifierData>() | ||
.toHaveProperty('private') | ||
.toEqualTypeOf<Nilable<boolean>>() | ||
}) | ||
}) | ||
}) |
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,49 @@ | ||
/** | ||
* @file Nodes - Identifier | ||
* @module esast/nodes/Identifier | ||
*/ | ||
|
||
import type { Data, Node } from '@flex-development/esast' | ||
import type { Nilable, Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with identifiers. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface IdentifierData extends Data { | ||
/** | ||
* Private identifier? | ||
*/ | ||
private?: Nilable<boolean> | ||
} | ||
|
||
/** | ||
* An identifier. | ||
* | ||
* @see {@linkcode Node} | ||
* | ||
* @extends {Node} | ||
*/ | ||
interface Identifier extends Node { | ||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode IdentifierData} | ||
*/ | ||
data?: Optional<IdentifierData> | ||
|
||
/** | ||
* Identifier name. | ||
*/ | ||
name: string | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'identifier' | ||
} | ||
|
||
export type { IdentifierData, Identifier 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