maskdata 1.2.2 → 1.2.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.
package/tests/testUuid.js CHANGED
@@ -2,10 +2,8 @@
2
2
  const maskData = require('../index');
3
3
  const expect = require('chai').expect;
4
4
 
5
- describe('Mask UUID', function() {
6
-
7
- describe('Mask UUID with default options', function() {
8
-
5
+ describe('Mask UUID', function () {
6
+ describe('Mask UUID with default options', function () {
9
7
  // const defaultUuidMaskOptions = {
10
8
  // maskWith: "*",
11
9
  // unmaskedStartCharacters: 0,
@@ -23,22 +21,21 @@ describe('Mask UUID', function() {
23
21
  input: '123E4567-E89B-12D3-A456-426614174000',
24
22
  output: '********-****-****-****-************'
25
23
  }
26
- ]
24
+ ];
27
25
 
28
- testData.forEach(({title, input, output}) => {
29
- it(title, function() {
26
+ testData.forEach(({ title, input, output }) => {
27
+ it(title, function () {
30
28
  const masked = maskData.maskUuid(input);
31
29
  expect(masked).to.equal(output, 'masked output does not match expected value');
32
30
  });
33
- })
31
+ });
34
32
  });
35
33
 
36
- describe('Mask UUID with custom options', function() {
37
-
34
+ describe('Mask UUID with custom options', function () {
38
35
  const customUuidMaskOptions = {
39
- maskWith: "X",
40
- unmaskedStartCharacters: 5,
41
- unmaskedEndCharacters: 13
36
+ maskWith: 'X',
37
+ unmaskedStartCharacters: 5,
38
+ unmaskedEndCharacters: 13
42
39
  };
43
40
 
44
41
  let testData = [
@@ -52,53 +49,68 @@ describe('Mask UUID', function() {
52
49
  input: '123E4567-E89B-12D3-A456-426614174000',
53
50
  output: '123E4XXX-XXXX-XXXX-XXX6-426614174000'
54
51
  }
55
- ]
52
+ ];
56
53
 
57
- testData.forEach(({title, input, output}) => {
58
- it(title, function() {
54
+ testData.forEach(({ title, input, output }) => {
55
+ it(title, function () {
59
56
  const masked = maskData.maskUuid(input, customUuidMaskOptions);
60
57
  expect(masked).to.equal(output);
61
58
  });
62
59
  });
63
60
 
64
- const customUuidMaskOptions2 = { unmaskedStartCharacters: 8, unmaskedEndCharacters: 12};
65
- it('Edge case1: unmask only the parts of UUID', function() {
66
- const masked = maskData.maskUuid('123e4567-e89b-12d3-a456-426614174000', customUuidMaskOptions2);
67
- expect(masked).to.equal('123e4567-****-****-****-426614174000');
61
+ const customUuidMaskOptions2 = { unmaskedStartCharacters: 8, unmaskedEndCharacters: 12 };
62
+ it('Edge case1: unmask only the parts of UUID', function () {
63
+ const masked = maskData.maskUuid(
64
+ '123e4567-e89b-12d3-a456-426614174000',
65
+ customUuidMaskOptions2
66
+ );
67
+ expect(masked).to.equal('123e4567-****-****-****-426614174000');
68
68
  });
69
69
 
70
- const customUuidMaskOptions3 = { unmaskedStartCharacters: 32, unmaskedEndCharacters: 0};
71
- it('Edge case2: unmaskedStartCharacters = 32', function() {
72
- const masked = maskData.maskUuid('123e4567-e89b-12d3-a456-426614174000', customUuidMaskOptions3);
73
- expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
70
+ const customUuidMaskOptions3 = { unmaskedStartCharacters: 32, unmaskedEndCharacters: 0 };
71
+ it('Edge case2: unmaskedStartCharacters = 32', function () {
72
+ const masked = maskData.maskUuid(
73
+ '123e4567-e89b-12d3-a456-426614174000',
74
+ customUuidMaskOptions3
75
+ );
76
+ expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
74
77
  });
75
78
 
76
- const customUuidMaskOptions4 = { unmaskedStartCharacters: 0, unmaskedEndCharacters: 32};
77
- it('Edge case3: unmaskedEndCharacters = 32', function() {
78
- const masked = maskData.maskUuid('123e4567-e89b-12d3-a456-426614174000', customUuidMaskOptions4);
79
- expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
79
+ const customUuidMaskOptions4 = { unmaskedStartCharacters: 0, unmaskedEndCharacters: 32 };
80
+ it('Edge case3: unmaskedEndCharacters = 32', function () {
81
+ const masked = maskData.maskUuid(
82
+ '123e4567-e89b-12d3-a456-426614174000',
83
+ customUuidMaskOptions4
84
+ );
85
+ expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
80
86
  });
81
87
 
82
- const customUuidMaskOptions5 = { unmaskedStartCharacters: 33, unmaskedEndCharacters: 5};
83
- it('Edge case4: unmaskedStartCharacters > 32', function() {
84
- const masked = maskData.maskUuid('123e4567-e89b-12d3-a456-426614174000', customUuidMaskOptions5);
85
- expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
88
+ const customUuidMaskOptions5 = { unmaskedStartCharacters: 33, unmaskedEndCharacters: 5 };
89
+ it('Edge case4: unmaskedStartCharacters > 32', function () {
90
+ const masked = maskData.maskUuid(
91
+ '123e4567-e89b-12d3-a456-426614174000',
92
+ customUuidMaskOptions5
93
+ );
94
+ expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
86
95
  });
87
96
 
88
- const customUuidMaskOptions6 = { unmaskedStartCharacters: 1, unmaskedEndCharacters: 33};
89
- it('Edge case5: unmaskedEndCharacters > 32', function() {
90
- const masked = maskData.maskUuid('123e4567-e89b-12d3-a456-426614174000', customUuidMaskOptions6);
91
- expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
97
+ const customUuidMaskOptions6 = { unmaskedStartCharacters: 1, unmaskedEndCharacters: 33 };
98
+ it('Edge case5: unmaskedEndCharacters > 32', function () {
99
+ const masked = maskData.maskUuid(
100
+ '123e4567-e89b-12d3-a456-426614174000',
101
+ customUuidMaskOptions6
102
+ );
103
+ expect(masked).to.equal('123e4567-e89b-12d3-a456-426614174000');
92
104
  });
93
105
 
94
- it('Edge case6: incorrect UUID', function() {
95
- const masked = maskData.maskUuid('123567-e89b-12d3-a456-4264174000');
96
- expect(masked).to.equal('123567-e89b-12d3-a456-4264174000', 'No masking done');
106
+ it('Edge case6: incorrect UUID', function () {
107
+ const masked = maskData.maskUuid('123567-e89b-12d3-a456-4264174000');
108
+ expect(masked).to.equal('123567-e89b-12d3-a456-4264174000', 'No masking done');
97
109
  });
98
110
 
99
- it('Edge case7: incorrect UUID2', function() {
100
- const masked = maskData.maskUuid('123e4567-mnop-12d3-a456-426614174000');
101
- expect(masked).to.equal('123e4567-mnop-12d3-a456-426614174000');
111
+ it('Edge case7: incorrect UUID2', function () {
112
+ const masked = maskData.maskUuid('123e4567-mnop-12d3-a456-426614174000');
113
+ expect(masked).to.equal('123e4567-mnop-12d3-a456-426614174000');
102
114
  });
103
115
  });
104
- });
116
+ });