From b94b59364790d9e38c189fa15380d20351f626c0 Mon Sep 17 00:00:00 2001 From: Gleb Bashkatov Date: Tue, 6 Feb 2024 17:01:45 +0000 Subject: [PATCH] fix: remove unrelated test --- src/repro.spec.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/repro.spec.ts diff --git a/src/repro.spec.ts b/src/repro.spec.ts deleted file mode 100644 index e56c07d..0000000 --- a/src/repro.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ClassConstructor, plainToInstance } from 'class-transformer'; - -import { IsDate } from '../lib/nestjs-swagger-dto'; - -export class ReportDto { - @IsDate({ format: 'date-time' }) - createdAt!: Date; -} - -describe('x', () => { - it('works 1', () => { - make1(ReportDto, { createdAt: new Date() }); - make1(ReportDto, { createdAt: '' as never }); - make1(ReportDto, {} as never); - }); - - it('works 2', () => { - make2(ReportDto, { createdAt: new Date() }); - make2(ReportDto, { createdAt: '' as never }); - make2(ReportDto, {} as never); - }); -}); - -export function make1(cls: ClassConstructor, data: D): T { - return plainToInstance(cls, data); -} - -export function make2(cls: ClassConstructor, object: D): D { - return Object.assign(new cls() as never, object); -}