Skip to content

Commit 1b6cbf1

Browse files
Update TypeScriptConstrainer.spec.ts
1 parent 9699cf9 commit 1b6cbf1

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/generators/typescript/TypeScriptConstrainer.spec.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('TypeScriptConstrainer', () => {
7979
});
8080
});
8181
describe('String', () => {
82-
test('should render type', () => {
82+
test('should render string type for string', () => {
8383
const model = new ConstrainedStringModel('test', undefined, {}, '');
8484
const type = TypeScriptDefaultTypeMapping.String({
8585
constrainedModel: model,
@@ -88,6 +88,24 @@ describe('TypeScriptConstrainer', () => {
8888
});
8989
expect(type).toEqual('string');
9090
});
91+
test('should render Date type for date', () => {
92+
const model = new ConstrainedStringModel('test', undefined, { format: 'date' }, '');
93+
const type = TypeScriptDefaultTypeMapping.String({
94+
constrainedModel: model,
95+
options: TypeScriptGenerator.defaultOptions,
96+
dependencyManager: undefined as never
97+
});
98+
expect(type).toEqual('Date');
99+
});
100+
test('should render Date type for date-time', () => {
101+
const model = new ConstrainedStringModel('test', undefined, { format: 'date-time' }, '');
102+
const type = TypeScriptDefaultTypeMapping.String({
103+
constrainedModel: model,
104+
options: TypeScriptGenerator.defaultOptions,
105+
dependencyManager: undefined as never
106+
});
107+
expect(type).toEqual('Date');
108+
});
91109
});
92110
describe('Boolean', () => {
93111
test('should render type', () => {

0 commit comments

Comments
 (0)