1
0

Better org of tests

This commit is contained in:
2020-03-06 13:08:13 -05:00
parent 6c101bb7b2
commit 62ab887ada
4 changed files with 40 additions and 36 deletions

View File

@@ -0,0 +1,22 @@
import 'reflect-metadata';
import { Serde } from "src/serde";
import { Exclude } from 'src/decorators';
class ExcludeTestModel extends Serde<ExcludeTestModel> {
name: string;
date: Date;
description: string;
@Exclude() frontendField: string;
}
describe('@Exclude() Decorator', () => {
it('should remove properties marked during serialize', () => {
const testModel = new ExcludeTestModel().deserialize({
name: 'test model',
description: 'this is a test model',
frontendField: 'test field'
});
const serializedModel = testModel.serialize();
expect(serializedModel).toEqual({ name: 'test model', description: 'this is a test model' });
});
});