-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Clone Date and Uint8Array types * Date Default is Current Time * Tests
- Loading branch information
1 parent
06bd0b8
commit ea217cc
Showing
10 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,30 @@ | ||
import { Value } from '@sinclair/typebox/value' | ||
import { Type } from '@sinclair/typebox' | ||
import { Assert } from '../../assert/index' | ||
|
||
describe('value/create/Date', () => { | ||
it('Should create value', () => { | ||
const T = Type.Date() | ||
const A = Value.Create(T) | ||
const B = new Date() | ||
Assert.InRange(A.getTime(), B.getTime(), 1000) | ||
}) | ||
it('Should create default', () => { | ||
const T = Type.Date({ default: new Date(1001) }) | ||
const A = Value.Create(T) | ||
const B = new Date(1001) | ||
Assert.IsEqual(A, B) | ||
}) | ||
it('Should create value nested', () => { | ||
const T = Type.Object({ value: Type.Date() }) | ||
const A = Value.Create(T) | ||
const B = { value: new Date() } | ||
Assert.InRange(A.value.getTime(), B.value.getTime(), 1000) | ||
}) | ||
it('Should create default nested', () => { | ||
const T = Type.Object({ value: Type.Date({ default: new Date(1001) }) }) | ||
const A = Value.Create(T) | ||
const B = { value: new Date(1001) } | ||
Assert.IsEqual(A, B) | ||
}) | ||
}) |
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