@@ -23,7 +23,7 @@ describe('Utils', () => {
23
23
expect ( Utils . stringify ( [ { one : afoo , two : afoo } ] ) ) . toBe ( '[{"one":{"a":"foo"}}]' ) ;
24
24
} ) ;
25
25
26
- it ( 'should exclude properties ', ( ) => {
26
+ describe ( 'stringify ', ( ) => {
27
27
var user :any = {
28
28
id :1 ,
29
29
name : 'Blake' ,
@@ -37,11 +37,27 @@ describe('Utils', () => {
37
37
}
38
38
} ;
39
39
40
- expect ( Utils . stringify ( user ) ) . toBe ( JSON . stringify ( user ) ) ;
41
- expect ( Utils . stringify ( user , [ 'pAssword' ] ) ) . toBe ( '{"id":1,"name":"Blake","passwordResetToken":"a reset token","myPasswordValue":"123456","myPassword":"123456","customValue":"Password","value":{}}' ) ;
42
- expect ( Utils . stringify ( user , [ '*password' ] ) ) . toBe ( '{"id":1,"name":"Blake","myPasswordValue":"123456","myPassword":"123456","customValue":"Password","value":{}}' ) ;
43
- expect ( Utils . stringify ( user , [ 'password*' ] ) ) . toBe ( '{"id":1,"name":"Blake","passwordResetToken":"a reset token","myPasswordValue":"123456","customValue":"Password","value":{}}' ) ;
44
- expect ( Utils . stringify ( user , [ '*password*' ] ) ) . toBe ( '{"id":1,"name":"Blake","customValue":"Password","value":{}}' ) ;
40
+ it ( 'should behave like JSON.stringify' , ( ) => {
41
+ expect ( Utils . stringify ( user ) ) . toBe ( JSON . stringify ( user ) ) ;
42
+ } ) ;
43
+
44
+ describe ( 'with exclude pattern' , ( ) => {
45
+ it ( 'pAssword' , ( ) => {
46
+ expect ( Utils . stringify ( user , [ 'pAssword' ] ) ) . toBe ( '{"id":1,"name":"Blake","passwordResetToken":"a reset token","myPasswordValue":"123456","myPassword":"123456","customValue":"Password","value":{}}' ) ;
47
+ } ) ;
48
+
49
+ it ( '*password' , ( ) => {
50
+ expect ( Utils . stringify ( user , [ '*password' ] ) ) . toBe ( '{"id":1,"name":"Blake","passwordResetToken":"a reset token","myPasswordValue":"123456","customValue":"Password","value":{}}' ) ;
51
+ } ) ;
52
+
53
+ it ( 'password*' , ( ) => {
54
+ expect ( Utils . stringify ( user , [ 'password*' ] ) ) . toBe ( '{"id":1,"name":"Blake","myPasswordValue":"123456","myPassword":"123456","customValue":"Password","value":{}}' ) ;
55
+ } ) ;
56
+
57
+ it ( '*password*' , ( ) => {
58
+ expect ( Utils . stringify ( user , [ '*password*' ] ) ) . toBe ( '{"id":1,"name":"Blake","customValue":"Password","value":{}}' ) ;
59
+ } ) ;
60
+ } ) ;
45
61
} ) ;
46
62
47
63
it ( 'should stringify array' , ( ) => {
0 commit comments