-
-
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 <[email protected]>
- Loading branch information
1 parent
682700e
commit 429bc12
Showing
92 changed files
with
1,800 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file Fixtures - OrderedPair | ||
* @module fixtures/OrderedPair | ||
*/ | ||
|
||
/** | ||
* Pair of numbers representing a single point on a two-dimensional grid. | ||
* | ||
* @see https://splashlearn.com/math-vocabulary/geometry/ordered-pair | ||
*/ | ||
interface IOrderedPair { | ||
x: number | ||
y: number | ||
} | ||
|
||
/** | ||
* Pair of numbers representing a single point on a two-dimensional grid. | ||
* | ||
* @see https://splashlearn.com/math-vocabulary/geometry/ordered-pair | ||
*/ | ||
type TOrderedPair = { | ||
x: number | ||
y: number | ||
} | ||
|
||
export type { IOrderedPair, TOrderedPair } |
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,38 @@ | ||
/** | ||
* @file Fixtures - Person | ||
* @module fixtures/Person | ||
*/ | ||
|
||
/** | ||
* Data model representing a person. | ||
* | ||
* @class | ||
*/ | ||
class Person { | ||
/** | ||
* @public | ||
* @instance | ||
* @member {string} first_name - First name | ||
*/ | ||
public first_name: string | ||
|
||
/** | ||
* @public | ||
* @instance | ||
* @member {string} last_name - Last name | ||
*/ | ||
public last_name: string | ||
|
||
/** | ||
* Creates a new person. | ||
* | ||
* @param {string} first_name - First name | ||
* @param {string} last_name - Last name | ||
*/ | ||
constructor(first_name: string, last_name: string) { | ||
this.first_name = first_name | ||
this.last_name = last_name | ||
} | ||
} | ||
|
||
export default Person |
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,38 @@ | ||
/** | ||
* @file Type Tests - AppEnv | ||
* @module tutils/enums/tests/unit-d/AppEnv | ||
*/ | ||
|
||
import type TestSubject from '../app-env' | ||
|
||
describe('unit-d:enums/AppEnv', () => { | ||
it('should match [CI = "ci"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('CI') | ||
.toMatchTypeOf<'ci'>() | ||
}) | ||
|
||
it('should match [DEV = "development"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('DEV') | ||
.toMatchTypeOf<'development'>() | ||
}) | ||
|
||
it('should match [PROD = "production"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('PROD') | ||
.toMatchTypeOf<'production'>() | ||
}) | ||
|
||
it('should match [STG = "staging"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('STG') | ||
.toMatchTypeOf<'staging'>() | ||
}) | ||
|
||
it('should match [TEST = "test"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('TEST') | ||
.toMatchTypeOf<'test'>() | ||
}) | ||
}) |
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 Type Tests - BsonTypeAlias | ||
* @module tutils/enums/tests/unit-d/BsonTypeAlias | ||
*/ | ||
|
||
import type TestSubject from '../bson-type-alias' | ||
|
||
describe('unit-d:enums/BsonTypeAlias', () => { | ||
it('should match [BOOL = "bool"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('BOOL') | ||
.toMatchTypeOf<'bool'>() | ||
}) | ||
|
||
it('should match [DECIMAL = "decimal"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('DECIMAL') | ||
.toMatchTypeOf<'decimal'>() | ||
}) | ||
|
||
it('should match [DOUBLE = "double"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('DOUBLE') | ||
.toMatchTypeOf<'double'>() | ||
}) | ||
|
||
it('should match [INT = "int"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('INT') | ||
.toMatchTypeOf<'int'>() | ||
}) | ||
|
||
it('should match [LONG = "long"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('LONG') | ||
.toMatchTypeOf<'long'>() | ||
}) | ||
|
||
it('should match [REGEX = "regex"]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('REGEX') | ||
.toMatchTypeOf<'regex'>() | ||
}) | ||
}) |
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,40 @@ | ||
/** | ||
* @file Type Tests - BsonTypeCode | ||
* @module tutils/enums/tests/unit-d/BsonTypeCode | ||
*/ | ||
|
||
import type TestSubject from '../bson-type-code' | ||
|
||
describe('unit-d:enums/BsonTypeCode', () => { | ||
it('should match [BOOL = 8]', () => { | ||
expectTypeOf<typeof TestSubject>().toHaveProperty('BOOL').toEqualTypeOf<8>() | ||
}) | ||
|
||
it('should match [DECIMAL = 19]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('DECIMAL') | ||
.toEqualTypeOf<19>() | ||
}) | ||
|
||
it('should match [DOUBLE = 1]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('DOUBLE') | ||
.toEqualTypeOf<1>() | ||
}) | ||
|
||
it('should match [INT = 16]', () => { | ||
expectTypeOf<typeof TestSubject>().toHaveProperty('INT').toEqualTypeOf<16>() | ||
}) | ||
|
||
it('should match [LONG = 18]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('LONG') | ||
.toEqualTypeOf<18>() | ||
}) | ||
|
||
it('should match [REGEX = 11]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('REGEX') | ||
.toEqualTypeOf<11>() | ||
}) | ||
}) |
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,26 @@ | ||
/** | ||
* @file Type Tests - CompareResult | ||
* @module tutils/enums/tests/unit-d/CompareResult | ||
*/ | ||
|
||
import type TestSubject from '../compare-result' | ||
|
||
describe('unit-d:enums/CompareResult', () => { | ||
it('should match [EQUAL = 8]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('EQUAL') | ||
.toEqualTypeOf<0>() | ||
}) | ||
|
||
it('should match [GREATER_THAN = 1]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('GREATER_THAN') | ||
.toEqualTypeOf<1>() | ||
}) | ||
|
||
it('should match [LESS_THAN = -1]', () => { | ||
expectTypeOf<typeof TestSubject>() | ||
.toHaveProperty('LESS_THAN') | ||
.toEqualTypeOf<-1>() | ||
}) | ||
}) |
Oops, something went wrong.