forked from wangziqi/gongxue-base
refactor: remove residual campus and department fields
This commit is contained in:
18
apps/server/src/archive/dto/archive.dto.spec.ts
Normal file
18
apps/server/src/archive/dto/archive.dto.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'reflect-metadata';
|
||||
import { plainToInstance } from 'class-transformer';
|
||||
import { validate } from 'class-validator';
|
||||
import { UpsertProfileDto } from './archive.dto';
|
||||
|
||||
describe('UpsertProfileDto retired fields', () => {
|
||||
it('removes the retired campusLocation field under whitelist validation', async () => {
|
||||
const dto = plainToInstance(UpsertProfileDto, {
|
||||
grade: '高三',
|
||||
campusLocation: '旧校区',
|
||||
});
|
||||
|
||||
await validate(dto, { whitelist: true });
|
||||
|
||||
expect(dto).toMatchObject({ grade: '高三' });
|
||||
expect(dto).not.toHaveProperty('campusLocation');
|
||||
});
|
||||
});
|
||||
@@ -5,7 +5,6 @@ export class UpsertProfileDto {
|
||||
@IsOptional() @IsString() targetMajor?: string;
|
||||
@IsOptional() @IsString() subjectDirection?: string;
|
||||
@IsOptional() @IsString() grade?: string;
|
||||
@IsOptional() @IsString() campusLocation?: string;
|
||||
@IsOptional() @IsDateString() profileDate?: string;
|
||||
@IsOptional() @IsString() notes?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user