maskdata 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,11 @@ describe('Masking strings', function () {
19
19
  title: 'test string with newline',
20
20
  input: 'this is a\nstring with newline',
21
21
  output: ''
22
+ },
23
+ {
24
+ title: 'test string with regex characters',
25
+ input: 'this is a $tring with ^,&,/,[,.,*,+,?,{,},(,),|,]',
26
+ output: ''
22
27
  }
23
28
  ];
24
29
 
@@ -37,6 +42,7 @@ describe('Masking strings', function () {
37
42
  localTestData[0].output = localTestData[0].input;
38
43
  localTestData[1].output = localTestData[1].input;
39
44
  localTestData[2].output = localTestData[2].input;
45
+ localTestData[3].output = localTestData[3].input;
40
46
 
41
47
  localTestData.forEach(({ title, input, output }) => {
42
48
  it(`default mask - ${title}`, function () {
@@ -61,6 +67,7 @@ describe('Masking strings', function () {
61
67
  localTestData[0].output = localTestData[0].input;
62
68
  localTestData[1].output = localTestData[1].input;
63
69
  localTestData[2].output = localTestData[2].input;
70
+ localTestData[3].output = localTestData[3].input;
64
71
 
65
72
  localTestData.forEach(({ title, input, output }) => {
66
73
  it(`custom mask - ${title}`, function () {
@@ -84,6 +91,7 @@ describe('Masking strings', function () {
84
91
  localTestData[0].output = '???? ?? ? ?????????? ??????';
85
92
  localTestData[1].output = '?'.repeat(localTestData[1].input.length); // no space here
86
93
  localTestData[2].output = '???? ?? ???????? ???? ???????';
94
+ localTestData[3].output = '???? ?? ? ?????? ???? ???????????????????????????';
87
95
 
88
96
  localTestData.forEach(({ title, input, output }) => {
89
97
  it(`custom mask - ${title}`, function () {
@@ -108,6 +116,7 @@ describe('Masking strings', function () {
108
116
  localTestData[0].output = maskChar.repeat(localTestData[0].input.length);
109
117
  localTestData[1].output = maskChar.repeat(localTestData[1].input.length);
110
118
  localTestData[2].output = maskChar.repeat(localTestData[2].input.length);
119
+ localTestData[3].output = maskChar.repeat(localTestData[3].input.length);
111
120
 
112
121
  localTestData.forEach(({ title, input, output }) => {
113
122
  it(`custom mask - ${title}`, function () {
@@ -121,7 +130,7 @@ describe('Masking strings', function () {
121
130
  const maskOptions = {
122
131
  maskWith: 'x',
123
132
  maskOnlyFirstOccurance: false,
124
- values: ['is', 'ing'],
133
+ values: ['is', 'ing', '$string'],
125
134
  maskAll: true,
126
135
  maskSpace: false
127
136
  };
@@ -131,6 +140,7 @@ describe('Masking strings', function () {
131
140
  localTestData[0].output = 'xxxx xx x xxxxxxxxxx xxxxxx';
132
141
  localTestData[1].output = 'x'.repeat(localTestData[1].input.length); // no spaces here
133
142
  localTestData[2].output = 'xxxx xx xxxxxxxx xxxx xxxxxxx';
143
+ localTestData[3].output = 'xxxx xx x xxxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx';
134
144
 
135
145
  localTestData.forEach(({ title, input, output }) => {
136
146
  it(`custom mask - ${title}`, function () {
@@ -144,7 +154,7 @@ describe('Masking strings', function () {
144
154
  const maskOptions = {
145
155
  maskWith: '*',
146
156
  maskOnlyFirstOccurance: false,
147
- values: ['is', 'ing'],
157
+ values: ['is', 'ing', '&,/'],
148
158
  maskAll: false,
149
159
  maskSpace: true
150
160
  };
@@ -153,6 +163,7 @@ describe('Masking strings', function () {
153
163
  localTestData[0].output = 'Th** ** a test***API Str***';
154
164
  localTestData[1].output = 'th****astr***';
155
165
  localTestData[2].output = 'th** ** a\nstr*** with newline';
166
+ localTestData[3].output = 'th** ** a $tr*** with ^,***,[,.,*,+,?,{,},(,),|,]';
156
167
 
157
168
  localTestData.forEach(({ title, input, output }) => {
158
169
  it(`custom mask - ${title}`, function () {
@@ -166,7 +177,7 @@ describe('Masking strings', function () {
166
177
  const maskOptions = {
167
178
  maskWith: '*',
168
179
  maskOnlyFirstOccurance: true,
169
- values: ['is', 'ing'],
180
+ values: ['is', 'ing', '^,&,/,[,.,*,+,?,{,},(,),|,]'],
170
181
  maskAll: false,
171
182
  maskSpace: true
172
183
  };
@@ -175,6 +186,7 @@ describe('Masking strings', function () {
175
186
  localTestData[0].output = 'Th** is a test***API String';
176
187
  localTestData[1].output = 'th**isastr***';
177
188
  localTestData[2].output = 'th** is a\nstr*** with newline';
189
+ localTestData[3].output = 'th** is a $tr*** with ***************************';
178
190
 
179
191
  localTestData.forEach(({ title, input, output }) => {
180
192
  it(`custom mask - ${title}`, function () {
@@ -233,7 +245,7 @@ describe('Masking strings', function () {
233
245
  }
234
246
  ];
235
247
 
236
- testData.forEach(({ title, input, output }) => {
248
+ testData.forEach(({ title, input }) => {
237
249
  it(`special input - ${title}`, function () {
238
250
  const masked = maskData.maskString(input, maskOptions);
239
251
  expect(masked).to.equal(input, "input won't be masked");