-
-
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.
- https://vitest.dev/guide/testing-types.html Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
f0a7eb1
commit 8a2b64f
Showing
7 changed files
with
75 additions
and
15 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,17 @@ | ||
/** | ||
* @file Type Tests - GetIteratorMethodOptions | ||
* @module aggregate-error-ponyfill/tests/unit-d/GetIteratorMethodOptions | ||
*/ | ||
|
||
import type getIteratorMethod from 'es-abstract/helpers/getIteratorMethod' | ||
import type TestSubject from '../options-get-iterator-method' | ||
|
||
describe('unit-d:GetIteratorMethodOptions', () => { | ||
it('should equal Parameters<typeof getIteratorMethod>["0"]', () => { | ||
// Arrange | ||
type Expected = Parameters<typeof getIteratorMethod>['0'] | ||
|
||
// Expect | ||
expectTypeOf<TestSubject>().toEqualTypeOf<Expected> | ||
}) | ||
}) |
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,19 @@ | ||
/** | ||
* @file Type Tests - Options | ||
* @module aggregate-error-ponyfill/tests/unit-d/Options | ||
*/ | ||
|
||
import type { KeysRequired } from '@flex-development/tutils' | ||
import type TestSubject from '../options' | ||
|
||
describe('unit-d:Options', () => { | ||
it('should allow empty object', () => { | ||
expectTypeOf<KeysRequired<TestSubject>>().toBeNever() | ||
}) | ||
|
||
it('should match [cause?: Cause | undefined]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('cause') | ||
.toEqualTypeOf<unknown | undefined>() | ||
}) | ||
}) |
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,24 @@ | ||
/** | ||
* @file Type Tests - AggregateError | ||
* @module aggregate-error-ponyfill/tests/unit-d/AggregateError | ||
*/ | ||
|
||
import type TestSubject from '../ponyfill' | ||
|
||
describe('unit-d:AggregateError', () => { | ||
it('should extend Error', () => { | ||
expectTypeOf<TestSubject>().toMatchTypeOf<Error>() | ||
}) | ||
|
||
it('should match [cause?: Cause | undefined]', () => { | ||
expectTypeOf<TestSubject<any, string>>() | ||
.toHaveProperty('cause') | ||
.toEqualTypeOf<string | undefined>() | ||
}) | ||
|
||
it('should match [errors: T[]]', () => { | ||
expectTypeOf<TestSubject<Error | string>>() | ||
.toHaveProperty('errors') | ||
.toEqualTypeOf<(Error | string)[]>() | ||
}) | ||
}) |
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
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