@@ -3,8 +3,8 @@ import {expect} from "chai";
3
3
import { classToPlain , plainToClass } from "../../src/index" ;
4
4
import { defaultMetadataStorage } from "../../src/storage" ;
5
5
import { Expose , Transform , Type } from "../../src/decorators" ;
6
+ import { TransformationType } from "../../src/TransformationType" ;
6
7
import * as moment from "moment" ;
7
- import { TransformationType } from "../../src/TransformOperationExecutor" ;
8
8
9
9
describe ( "custom transformation decorator" , ( ) => {
10
10
@@ -158,7 +158,7 @@ describe("custom transformation decorator", () => {
158
158
objArg . should . be . equal ( user ) ;
159
159
typeArg . should . be . equal ( TransformationType . CLASS_TO_PLAIN ) ;
160
160
} ) ;
161
-
161
+
162
162
let model : any ;
163
163
it ( "should serialize json into model instance of class Person" , ( ) => {
164
164
expect ( ( ) => {
@@ -184,24 +184,24 @@ describe("custom transformation decorator", () => {
184
184
}
185
185
class Address {
186
186
public street : string ;
187
-
188
- @Expose ( { name : "tel" } )
187
+
188
+ @Expose ( { name : "tel" } )
189
189
public telephone : string ;
190
-
190
+
191
191
public zip : number ;
192
-
192
+
193
193
public country : string ;
194
194
}
195
195
class Person {
196
196
public name : string ;
197
-
197
+
198
198
@Type ( ( ) => Address )
199
199
public address : Address ;
200
-
200
+
201
201
@Type ( ( ) => Hobby )
202
202
@Transform ( value => value . filter ( ( hobby : any ) => hobby . type === "sport" ) , { toClassOnly : true } )
203
203
public hobbies : Hobby [ ] ;
204
-
204
+
205
205
public age : number ;
206
206
}
207
207
model = plainToClass ( Person , json ) ;
@@ -210,7 +210,7 @@ describe("custom transformation decorator", () => {
210
210
model . hobbies . forEach ( ( hobby : Hobby ) => expect ( hobby instanceof Hobby && hobby . type === "sport" ) ) ;
211
211
} ) . to . not . throw ( ) ;
212
212
} ) ;
213
-
213
+
214
214
it ( "should serialize a model into json" , ( ) => {
215
215
expect ( ( ) => {
216
216
classToPlain ( model ) ;
0 commit comments