@futdevpro/fsm-dynamo 1.9.10 → 1.9.14

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.
Files changed (124) hide show
  1. package/.github/workflows/main.yml +222 -0
  2. package/HOWTO.md +15 -15
  3. package/README.md +17 -17
  4. package/build/_models/control-models/error.control-model.js +1 -1
  5. package/build/_models/control-models/error.control-model.js.map +1 -1
  6. package/build/_models/control-models/error.control-model.spec.js +25 -6
  7. package/build/_models/control-models/error.control-model.spec.js.map +1 -1
  8. package/build/_modules/utils.index.d.ts +2 -0
  9. package/build/_modules/utils.index.d.ts.map +1 -0
  10. package/build/_modules/utils.index.js +5 -0
  11. package/build/_modules/utils.index.js.map +1 -0
  12. package/futdevpro-fsm-dynamo-01.09.14.tgz +0 -0
  13. package/nodemon.json +11 -11
  14. package/package.json +160 -151
  15. package/src/_collections/assets/location/country-codes-ISO-3166.json +3239 -3239
  16. package/src/_collections/assets/location/country-divisions-ISO-3166-all-list.json +19035 -19035
  17. package/src/_collections/assets/location/country-divisions-ISO-3166.json +4993 -4993
  18. package/src/_collections/assets/location/country-phone-codes.json +1203 -1203
  19. package/src/_collections/constants/country-divisions.const.ts +9 -9
  20. package/src/_collections/constants/courtry-isos.const.ts +8 -8
  21. package/src/_collections/constants/error-defaults.const.ts +11 -11
  22. package/src/_collections/constants/index.ts +15 -15
  23. package/src/_collections/constants/module-settings/custom-data-module-settings.const.ts +15 -15
  24. package/src/_collections/constants/module-settings/index.ts +8 -8
  25. package/src/_collections/constants/module-settings/test-module-settings.const.ts +19 -19
  26. package/src/_collections/constants/module-settings/usage-module-settings.const.ts +19 -19
  27. package/src/_collections/constants/pipe-transforms.const.ts +35 -35
  28. package/src/_collections/constants/times.const.ts +8 -8
  29. package/src/_collections/index.ts +6 -6
  30. package/src/_collections/utils/array.util.spec.ts +39 -39
  31. package/src/_collections/utils/array.util.ts +137 -137
  32. package/src/_collections/utils/index.ts +18 -18
  33. package/src/_collections/utils/location.util.ts +55 -55
  34. package/src/_collections/utils/log.util.ts +239 -239
  35. package/src/_collections/utils/math/box-bounds.util.ts +85 -85
  36. package/src/_collections/utils/math/index.ts +5 -5
  37. package/src/_collections/utils/math/math.util.ts +53 -53
  38. package/src/_collections/utils/math/random.util.ts +80 -80
  39. package/src/_collections/utils/math/trigonometry.util.ts +73 -73
  40. package/src/_collections/utils/math/vector2.util.ts +197 -197
  41. package/src/_collections/utils/pipe-transforms/country-pipe.util.ts +18 -18
  42. package/src/_collections/utils/pipe-transforms/custom-pipe.util.ts +9 -9
  43. package/src/_collections/utils/pipe-transforms/division-pipe.util.ts +20 -20
  44. package/src/_collections/utils/pipe-transforms/index.ts +15 -15
  45. package/src/_collections/utils/pipe-transforms/list-pipe.util.ts +10 -10
  46. package/src/_collections/utils/pipe-transforms/multi-pipe-pipe.util.ts +160 -160
  47. package/src/_collections/utils/pipe-transforms/obj-key-pipe.util.ts +9 -9
  48. package/src/_collections/utils/pipe-transforms/range-pipe.util.ts +94 -94
  49. package/src/_collections/utils/pipe-transforms/region-pipe.util.ts +18 -18
  50. package/src/_collections/utils/pipe-transforms/replace-pipe.util.ts +11 -11
  51. package/src/_collections/utils/pipe-transforms/slider-pipe.util.ts +20 -20
  52. package/src/_collections/utils/pipe-transforms/smart-replace-pipe.util.ts +71 -71
  53. package/src/_collections/utils/regex/index.ts +4 -4
  54. package/src/_collections/utils/regex/password-regex.util.ts +52 -52
  55. package/src/_collections/utils/regex/regex.util.ts +6 -6
  56. package/src/_collections/utils/regex/username-regex.util.ts +33 -33
  57. package/src/_collections/utils/regions.util.ts +100 -100
  58. package/src/_collections/utils/round-list.util.ts +44 -44
  59. package/src/_collections/utils/shared.static-service.ts +177 -177
  60. package/src/_collections/utils/time.util.spec.ts +50 -50
  61. package/src/_collections/utils/time.util.ts +219 -219
  62. package/src/_collections/utils/type-cloning-facility.util.ts +121 -121
  63. package/src/_collections/utils/utilities.util.ts +130 -130
  64. package/src/_enums/basic-property-type.enum.ts +9 -9
  65. package/src/_enums/data-model-type.enum.ts +13 -13
  66. package/src/_enums/day-of-week.enum.ts +28 -28
  67. package/src/_enums/error-level.enum.ts +17 -17
  68. package/src/_enums/index.ts +16 -16
  69. package/src/_enums/location/index.ts +3 -3
  70. package/src/_enums/location/region.enum.ts +9 -9
  71. package/src/_enums/location/sub-region.enum.ts +26 -26
  72. package/src/_enums/location/subdivision-region-type.enum.ts +44 -44
  73. package/src/_enums/log-style.enum.ts +30 -30
  74. package/src/_enums/month.enum.ts +16 -16
  75. package/src/_enums/pipe.enum.ts +45 -45
  76. package/src/_enums/range-pipe-setting.enum.ts +11 -11
  77. package/src/_enums/time/day-of-week.enum.ts +28 -28
  78. package/src/_enums/time/index.ts +3 -3
  79. package/src/_enums/time/month.enum.ts +16 -16
  80. package/src/_enums/time/relative-date.enum.ts +13 -13
  81. package/src/_models/control-models/daily-usage-data.control-model.ts +21 -21
  82. package/src/_models/control-models/data-model-params.control-model.ts +39 -39
  83. package/src/_models/control-models/data-property-params.control-model.ts +106 -106
  84. package/src/_models/control-models/error.control-model.spec.ts +753 -716
  85. package/src/_models/control-models/error.control-model.ts +722 -722
  86. package/src/_models/control-models/index.ts +10 -10
  87. package/src/_models/control-models/poll.control-model.ts +113 -113
  88. package/src/_models/control-models/range-value.control-model.ts +142 -142
  89. package/src/_models/control-models/usage-action.control-model.ts +15 -15
  90. package/src/_models/control-models/usage-data.control-model.ts +20 -20
  91. package/src/_models/data-models/custom-data.data-model.ts +28 -28
  92. package/src/_models/data-models/index.ts +5 -5
  93. package/src/_models/data-models/metadata.data-model.ts +83 -83
  94. package/src/_models/data-models/usage-session.data-model.ts +53 -53
  95. package/src/_models/index.ts +12 -12
  96. package/src/_models/interfaces/error-defaults.interface.ts +11 -11
  97. package/src/_models/interfaces/index.ts +11 -11
  98. package/src/_models/interfaces/location/country-division.interface.ts +7 -7
  99. package/src/_models/interfaces/location/country-iso.interface.ts +21 -21
  100. package/src/_models/interfaces/location/country-phone-code.interface.ts +7 -7
  101. package/src/_models/interfaces/location/division-collection.interface.ts +10 -10
  102. package/src/_models/interfaces/location/division-region-data.interface.ts +8 -8
  103. package/src/_models/interfaces/location/geo-ip-location.interface.ts +26 -26
  104. package/src/_models/interfaces/location/index.ts +10 -10
  105. package/src/_models/interfaces/location/location-coordinates.interface.ts +5 -5
  106. package/src/_models/interfaces/multi-pipe-settings.type.ts +7 -7
  107. package/src/_models/interfaces/paged.interface.ts +11 -11
  108. package/src/_models/interfaces/pipe-transforms.interface.ts +29 -29
  109. package/src/_models/interfaces/random-weight.interface.ts +7 -7
  110. package/src/_models/interfaces/route-settings.interface.ts +11 -11
  111. package/src/_modules/collections.index.ts +2 -2
  112. package/src/_modules/constants.index.ts +2 -2
  113. package/src/_modules/custom-data-module.index.ts +6 -6
  114. package/src/_modules/data-modules.index.ts +9 -9
  115. package/src/_modules/enums.index.ts +2 -2
  116. package/src/_modules/error-module.index.ts +8 -8
  117. package/src/_modules/location.index.ts +15 -15
  118. package/src/_modules/models.index.ts +2 -2
  119. package/src/_modules/shared-service.index.ts +9 -9
  120. package/src/_modules/test-module.index.ts +5 -5
  121. package/src/_modules/usage-module.index.ts +10 -10
  122. package/src/_modules/utils.index.ts +4 -0
  123. package/tsconfig.json +29 -29
  124. package/tslint.json +153 -153
@@ -1,177 +1,177 @@
1
-
2
- import { DynamoFM_clone } from './utilities.util';
3
-
4
- export type DFM_Shared = DynamoFM_Shared;
5
- export class DynamoFM_Shared {
6
-
7
- /**
8
- * returns remapped object list by path list
9
- * @param objList object list to map
10
- * @param paths string list of path etc.:
11
- * ```ts
12
- * [ [ 'first', 'sub', 'label' ], [ 'first', 'dif', 'name' ] ]
13
- * ```
14
- * will be...
15
- * from
16
- * ```ts
17
- * {
18
- * first: {
19
- * sub: {
20
- * label: 'vlmi'
21
- * },
22
- * dif: {
23
- * name: 'asd'
24
- * }
25
- * }
26
- * }[]
27
- * ```
28
- * to
29
- * ```
30
- * { label: 'vlmi', name: 'asd' }[]
31
- * ```
32
- * @returns remapped object list (the final obj will use the deepest keys)
33
- */
34
- static mapObjList(objList: object[], paths: string[][]): object[] {
35
- let newObjList = [...objList];
36
-
37
- newObjList = newObjList.map((obj): any => {
38
- const newObj = {};
39
-
40
- paths.forEach((path: string[]): void => {
41
- newObj[path[path.length - 1]] = this.getNestedData(obj, path);
42
- });
43
-
44
- return newObj;
45
- });
46
-
47
- return newObjList;
48
- }
49
-
50
- /**
51
- * returns nested value from object
52
- * @param parentObj data source object
53
- * @param nestedDataKeys path of value as string list
54
- * etc.: ['nestLvl1', 'nestLvl2', 'nestLvl3'] as parentObj.nestLvl1.nestLvl2.nestLvl3
55
- * @returns data from object by path
56
- */
57
- static getNestedData(parentObj: object, nestedDataKeys: string[]): any {
58
- let newData = DynamoFM_clone(parentObj); // {...parentObj};
59
-
60
- nestedDataKeys.forEach((dk: string): void => {
61
- if (newData) {
62
- newData = newData[dk];
63
- }
64
- });
65
-
66
- return newData;
67
- }
68
-
69
- /**
70
- * recursive function that nests data
71
- * @param newData the object that that is needed to be updated
72
- * @param nestKeys the path where the data should be updated
73
- * @param dataToSet the actual value that will be setted
74
- * @returns modified data
75
- */
76
- static nestData(parentObj: object, nestKeys: string[], dataToSet: any): object {
77
- const newData = DynamoFM_clone(parentObj); // {...parentObj};
78
-
79
- if (nestKeys.length > 1) {
80
- const keys = [...nestKeys];
81
- const nextNestKey = keys.shift();
82
-
83
- newData[nextNestKey] = this.nestData(newData[nextNestKey], keys, dataToSet);
84
- } else {
85
- newData[nestKeys[0]] = dataToSet;
86
- }
87
-
88
- return newData;
89
- }
90
-
91
- /**
92
- * recursive function that adds to nested data
93
- * @param newData the object that that is needed to be updated
94
- * @param nestKeys the path where the data should be updated
95
- * @param dataToAdd the actual value that will be setted
96
- * @returns modified data
97
- */
98
- static addToNestedData(parentObj: object, nestKeys: string[], dataToAdd: any): object {
99
- const newData = DynamoFM_clone(parentObj); // {...parentObj};
100
-
101
- if (nestKeys.length > 1) {
102
- const keys = [...nestKeys];
103
- const nextNestKey = keys.shift();
104
-
105
- newData[nextNestKey] = this.addToNestedData(newData[nextNestKey], keys, dataToAdd);
106
- } else {
107
- newData[nestKeys[0]] += dataToAdd;
108
- }
109
-
110
- return newData;
111
- }
112
-
113
- /**
114
- * recursive function that pushes to nested data
115
- * @param newData the object that that is needed to be updated
116
- * @param nestKeys the path where the data should be updated
117
- * @param dataToPush the actual value that will be setted
118
- * @returns modified data
119
- */
120
- static pushToNestedData(parentObj: object, nestKeys: string[], dataToPush: any): object {
121
- const newData = DynamoFM_clone(parentObj); // {...parentObj};
122
-
123
- if (nestKeys.length > 1) {
124
- const keys = [...nestKeys];
125
- const nextNestKey = keys.shift();
126
-
127
- newData[nextNestKey] = this.pushToNestedData(newData[nextNestKey], keys, dataToPush);
128
- } else {
129
- if (Array.isArray(newData[nestKeys[0]])) {
130
- newData[nestKeys[0]].push(dataToPush);
131
- } else {
132
- newData[nestKeys[0]] = [dataToPush];
133
- }
134
- }
135
-
136
- return newData;
137
- }
138
-
139
- /**
140
- * recursive function that nests data on recursive data structure etc.: xData: { ..., 'nestedListKey': xData[] }
141
- * @param newData the object that that is needed to be updated
142
- * @param nestedListKey the location of nested dataList
143
- * @param nestIndexes path to the subject ect.: xData.listKey[1].listKey[4].listKey[0] will be [1, 4, 0]
144
- * @param dataToSet the actual value that will be setted on location
145
- * @returns modified data
146
- */
147
- static nestRecursiveListedData<T>(
148
- parentObj: T,
149
- nestedListKey: string,
150
- nestIndexes: number[],
151
- dataToSet: any
152
- ): T {
153
- const newData = DynamoFM_clone(parentObj); // parentObj; // {...parentObj};
154
-
155
- if (nestIndexes.length > 1) {
156
- const indexes = [...nestIndexes];
157
- const nextLevelKey = indexes.shift();
158
-
159
- newData[nestedListKey][nextLevelKey] = this.nestRecursiveListedData(
160
- newData[nestedListKey][nextLevelKey], nestedListKey, indexes, dataToSet
161
- );
162
- } else {
163
- newData[nestedListKey][nestIndexes[0]] = dataToSet;
164
- }
165
-
166
- return newData;
167
- }
168
-
169
- static addMetadataToSchema(schema: any): any {
170
- schema.__created = { type: Date };
171
- schema.__createdBy = { type: String };
172
- schema.__lastModified = { type: Date };
173
- schema.__lastModifiedBy = { type: String };
174
-
175
- return schema;
176
- }
177
- }
1
+
2
+ import { DynamoFM_clone } from './utilities.util';
3
+
4
+ export type DFM_Shared = DynamoFM_Shared;
5
+ export class DynamoFM_Shared {
6
+
7
+ /**
8
+ * returns remapped object list by path list
9
+ * @param objList object list to map
10
+ * @param paths string list of path etc.:
11
+ * ```ts
12
+ * [ [ 'first', 'sub', 'label' ], [ 'first', 'dif', 'name' ] ]
13
+ * ```
14
+ * will be...
15
+ * from
16
+ * ```ts
17
+ * {
18
+ * first: {
19
+ * sub: {
20
+ * label: 'vlmi'
21
+ * },
22
+ * dif: {
23
+ * name: 'asd'
24
+ * }
25
+ * }
26
+ * }[]
27
+ * ```
28
+ * to
29
+ * ```
30
+ * { label: 'vlmi', name: 'asd' }[]
31
+ * ```
32
+ * @returns remapped object list (the final obj will use the deepest keys)
33
+ */
34
+ static mapObjList(objList: object[], paths: string[][]): object[] {
35
+ let newObjList = [...objList];
36
+
37
+ newObjList = newObjList.map((obj): any => {
38
+ const newObj = {};
39
+
40
+ paths.forEach((path: string[]): void => {
41
+ newObj[path[path.length - 1]] = this.getNestedData(obj, path);
42
+ });
43
+
44
+ return newObj;
45
+ });
46
+
47
+ return newObjList;
48
+ }
49
+
50
+ /**
51
+ * returns nested value from object
52
+ * @param parentObj data source object
53
+ * @param nestedDataKeys path of value as string list
54
+ * etc.: ['nestLvl1', 'nestLvl2', 'nestLvl3'] as parentObj.nestLvl1.nestLvl2.nestLvl3
55
+ * @returns data from object by path
56
+ */
57
+ static getNestedData(parentObj: object, nestedDataKeys: string[]): any {
58
+ let newData = DynamoFM_clone(parentObj); // {...parentObj};
59
+
60
+ nestedDataKeys.forEach((dk: string): void => {
61
+ if (newData) {
62
+ newData = newData[dk];
63
+ }
64
+ });
65
+
66
+ return newData;
67
+ }
68
+
69
+ /**
70
+ * recursive function that nests data
71
+ * @param newData the object that that is needed to be updated
72
+ * @param nestKeys the path where the data should be updated
73
+ * @param dataToSet the actual value that will be setted
74
+ * @returns modified data
75
+ */
76
+ static nestData(parentObj: object, nestKeys: string[], dataToSet: any): object {
77
+ const newData = DynamoFM_clone(parentObj); // {...parentObj};
78
+
79
+ if (nestKeys.length > 1) {
80
+ const keys = [...nestKeys];
81
+ const nextNestKey = keys.shift();
82
+
83
+ newData[nextNestKey] = this.nestData(newData[nextNestKey], keys, dataToSet);
84
+ } else {
85
+ newData[nestKeys[0]] = dataToSet;
86
+ }
87
+
88
+ return newData;
89
+ }
90
+
91
+ /**
92
+ * recursive function that adds to nested data
93
+ * @param newData the object that that is needed to be updated
94
+ * @param nestKeys the path where the data should be updated
95
+ * @param dataToAdd the actual value that will be setted
96
+ * @returns modified data
97
+ */
98
+ static addToNestedData(parentObj: object, nestKeys: string[], dataToAdd: any): object {
99
+ const newData = DynamoFM_clone(parentObj); // {...parentObj};
100
+
101
+ if (nestKeys.length > 1) {
102
+ const keys = [...nestKeys];
103
+ const nextNestKey = keys.shift();
104
+
105
+ newData[nextNestKey] = this.addToNestedData(newData[nextNestKey], keys, dataToAdd);
106
+ } else {
107
+ newData[nestKeys[0]] += dataToAdd;
108
+ }
109
+
110
+ return newData;
111
+ }
112
+
113
+ /**
114
+ * recursive function that pushes to nested data
115
+ * @param newData the object that that is needed to be updated
116
+ * @param nestKeys the path where the data should be updated
117
+ * @param dataToPush the actual value that will be setted
118
+ * @returns modified data
119
+ */
120
+ static pushToNestedData(parentObj: object, nestKeys: string[], dataToPush: any): object {
121
+ const newData = DynamoFM_clone(parentObj); // {...parentObj};
122
+
123
+ if (nestKeys.length > 1) {
124
+ const keys = [...nestKeys];
125
+ const nextNestKey = keys.shift();
126
+
127
+ newData[nextNestKey] = this.pushToNestedData(newData[nextNestKey], keys, dataToPush);
128
+ } else {
129
+ if (Array.isArray(newData[nestKeys[0]])) {
130
+ newData[nestKeys[0]].push(dataToPush);
131
+ } else {
132
+ newData[nestKeys[0]] = [dataToPush];
133
+ }
134
+ }
135
+
136
+ return newData;
137
+ }
138
+
139
+ /**
140
+ * recursive function that nests data on recursive data structure etc.: xData: { ..., 'nestedListKey': xData[] }
141
+ * @param newData the object that that is needed to be updated
142
+ * @param nestedListKey the location of nested dataList
143
+ * @param nestIndexes path to the subject ect.: xData.listKey[1].listKey[4].listKey[0] will be [1, 4, 0]
144
+ * @param dataToSet the actual value that will be setted on location
145
+ * @returns modified data
146
+ */
147
+ static nestRecursiveListedData<T>(
148
+ parentObj: T,
149
+ nestedListKey: string,
150
+ nestIndexes: number[],
151
+ dataToSet: any
152
+ ): T {
153
+ const newData = DynamoFM_clone(parentObj); // parentObj; // {...parentObj};
154
+
155
+ if (nestIndexes.length > 1) {
156
+ const indexes = [...nestIndexes];
157
+ const nextLevelKey = indexes.shift();
158
+
159
+ newData[nestedListKey][nextLevelKey] = this.nestRecursiveListedData(
160
+ newData[nestedListKey][nextLevelKey], nestedListKey, indexes, dataToSet
161
+ );
162
+ } else {
163
+ newData[nestedListKey][nestIndexes[0]] = dataToSet;
164
+ }
165
+
166
+ return newData;
167
+ }
168
+
169
+ static addMetadataToSchema(schema: any): any {
170
+ schema.__created = { type: Date };
171
+ schema.__createdBy = { type: String };
172
+ schema.__lastModified = { type: Date };
173
+ schema.__lastModifiedBy = { type: String };
174
+
175
+ return schema;
176
+ }
177
+ }
@@ -1,50 +1,50 @@
1
-
2
- import { DynamoFM_LogStyle } from '../../_enums';
3
- import { DynamoFM_Log } from './log.util';
4
- import { DynamoFM_Time } from './time.util';
5
-
6
- describe('DynamoFM_Time', () => {
7
- xit(DynamoFM_Log.addStyle('tenYearsAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
8
- const date = DynamoFM_Time.tenYearsAgo(new Date('2021-01-01'));
9
- const expected = new Date('2011-01-01');
10
-
11
- expect(date).toEqual(expected);
12
- });
13
-
14
- xit(DynamoFM_Log.addStyle('oneYearAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
15
- const date = DynamoFM_Time.oneYearAgo(new Date('2021-01-01'));
16
- const expected = new Date('2020-01-01');
17
-
18
- expect(date).toEqual(expected);
19
- });
20
-
21
- xit(DynamoFM_Log.addStyle('oneMonthAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
22
- const date = DynamoFM_Time.oneMonthAgo(new Date('2021-01-01'));
23
- const expected = new Date('2020-12-01');
24
-
25
- expect(date).toEqual(expected);
26
- });
27
-
28
- it(DynamoFM_Log.addStyle('oneWeekAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
29
- const date = DynamoFM_Time.oneWeekAgo(new Date('2021-01-01'));
30
- const expected = new Date('2020-12-25');
31
-
32
- expect(date).toEqual(expected);
33
- });
34
-
35
- it(DynamoFM_Log.addStyle('oneDayAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
36
- const date = DynamoFM_Time.oneDayAgo(new Date('2021-01-01'));
37
- const expected = new Date('2020-12-31');
38
-
39
- expect(date).toEqual(expected);
40
- });
41
-
42
- it(DynamoFM_Log.addStyle('oneHourAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
43
- const date = DynamoFM_Time.oneHourAgo(new Date('2021-01-01T00:00:00'));
44
- const expected = new Date('2020-12-31T23:00:00');
45
-
46
- expect(date).toEqual(expected);
47
- });
48
-
49
-
50
- });
1
+
2
+ import { DynamoFM_LogStyle } from '../../_enums';
3
+ import { DynamoFM_Log } from './log.util';
4
+ import { DynamoFM_Time } from './time.util';
5
+
6
+ describe('DynamoFM_Time', () => {
7
+ xit(DynamoFM_Log.addStyle('tenYearsAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
8
+ const date = DynamoFM_Time.tenYearsAgo(new Date('2021-01-01'));
9
+ const expected = new Date('2011-01-01');
10
+
11
+ expect(date).toEqual(expected);
12
+ });
13
+
14
+ xit(DynamoFM_Log.addStyle('oneYearAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
15
+ const date = DynamoFM_Time.oneYearAgo(new Date('2021-01-01'));
16
+ const expected = new Date('2020-01-01');
17
+
18
+ expect(date).toEqual(expected);
19
+ });
20
+
21
+ xit(DynamoFM_Log.addStyle('oneMonthAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
22
+ const date = DynamoFM_Time.oneMonthAgo(new Date('2021-01-01'));
23
+ const expected = new Date('2020-12-01');
24
+
25
+ expect(date).toEqual(expected);
26
+ });
27
+
28
+ it(DynamoFM_Log.addStyle('oneWeekAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
29
+ const date = DynamoFM_Time.oneWeekAgo(new Date('2021-01-01'));
30
+ const expected = new Date('2020-12-25');
31
+
32
+ expect(date).toEqual(expected);
33
+ });
34
+
35
+ it(DynamoFM_Log.addStyle('oneDayAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
36
+ const date = DynamoFM_Time.oneDayAgo(new Date('2021-01-01'));
37
+ const expected = new Date('2020-12-31');
38
+
39
+ expect(date).toEqual(expected);
40
+ });
41
+
42
+ it(DynamoFM_Log.addStyle('oneHourAgo', [DynamoFM_LogStyle.yellow]) +' should return correct date', () => {
43
+ const date = DynamoFM_Time.oneHourAgo(new Date('2021-01-01T00:00:00'));
44
+ const expected = new Date('2020-12-31T23:00:00');
45
+
46
+ expect(date).toEqual(expected);
47
+ });
48
+
49
+
50
+ });