-
-
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
3e6045b
commit 423d0bf
Showing
4 changed files
with
91 additions
and
13 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,37 @@ | ||
/** | ||
* @file Type Tests - Directive | ||
* @module esast/nodes/tests/unit-d/Directive | ||
*/ | ||
|
||
import type { Data, Literal } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../directive' | ||
|
||
describe('unit-d:nodes/Directive', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.DirectiveData | ||
|
||
it('should extend Literal', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Literal>() | ||
}) | ||
|
||
it('should match [data?: Optional<DirectiveData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "directive"]', () => { | ||
expectTypeOf<Subject>().toHaveProperty('type').toEqualTypeOf<'directive'>() | ||
}) | ||
|
||
it('should match [value: string]', () => { | ||
expectTypeOf<Subject>().toHaveProperty('value').toEqualTypeOf<string>() | ||
}) | ||
|
||
describe('DirectiveData', () => { | ||
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
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,44 @@ | ||
/** | ||
* @file Nodes - Directive | ||
* @module esast/nodes/Directive | ||
*/ | ||
|
||
import type { Data, Literal } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with directives. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface DirectiveData extends Data {} | ||
|
||
/** | ||
* A directive. | ||
* | ||
* @see {@linkcode Literal} | ||
* | ||
* @extends {Literal} | ||
*/ | ||
interface Directive extends Literal { | ||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode DirectiveData} | ||
*/ | ||
data?: Optional<DirectiveData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'directive' | ||
|
||
/** | ||
* The parsed directive. | ||
*/ | ||
value: string | ||
} | ||
|
||
export type { DirectiveData, Directive 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