@futdevpro/fsm-dynamo 1.9.51 → 1.10.2
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/.github/workflows/main.yml +3 -3
- package/build/_collections/utils/array.util.d.ts +1 -7
- package/build/_collections/utils/array.util.d.ts.map +1 -1
- package/build/_collections/utils/array.util.js +0 -31
- package/build/_collections/utils/array.util.js.map +1 -1
- package/build/_collections/utils/array.util.spec.js +0 -35
- package/build/_collections/utils/array.util.spec.js.map +1 -1
- package/build/_collections/utils/log.util.d.ts +1 -0
- package/build/_collections/utils/log.util.d.ts.map +1 -1
- package/build/_collections/utils/log.util.js +3 -0
- package/build/_collections/utils/log.util.js.map +1 -1
- package/build/_collections/utils/log.util.spec.d.ts +2 -0
- package/build/_collections/utils/log.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/log.util.spec.js +85 -0
- package/build/_collections/utils/log.util.spec.js.map +1 -0
- package/build/_collections/utils/math/box-bounds.util.spec.d.ts +2 -0
- package/build/_collections/utils/math/box-bounds.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/math/box-bounds.util.spec.js +53 -0
- package/build/_collections/utils/math/box-bounds.util.spec.js.map +1 -0
- package/build/_collections/utils/math/math.util.spec.d.ts +2 -0
- package/build/_collections/utils/math/math.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/math/math.util.spec.js +89 -0
- package/build/_collections/utils/math/math.util.spec.js.map +1 -0
- package/build/_collections/utils/math/random.util.spec.d.ts +2 -0
- package/build/_collections/utils/math/random.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/math/random.util.spec.js +75 -0
- package/build/_collections/utils/math/random.util.spec.js.map +1 -0
- package/build/_collections/utils/math/trigonometry.util.spec.d.ts +2 -0
- package/build/_collections/utils/math/trigonometry.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/math/trigonometry.util.spec.js +49 -0
- package/build/_collections/utils/math/trigonometry.util.spec.js.map +1 -0
- package/build/_collections/utils/math/vector2.util.spec.d.ts +2 -0
- package/build/_collections/utils/math/vector2.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/math/vector2.util.spec.js +82 -0
- package/build/_collections/utils/math/vector2.util.spec.js.map +1 -0
- package/build/_collections/utils/regex/password-regex.util.spec.d.ts +2 -0
- package/build/_collections/utils/regex/password-regex.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/regex/password-regex.util.spec.js +44 -0
- package/build/_collections/utils/regex/password-regex.util.spec.js.map +1 -0
- package/build/_collections/utils/regex/regex.util.spec.d.ts +2 -0
- package/build/_collections/utils/regex/regex.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/regex/regex.util.spec.js +40 -0
- package/build/_collections/utils/regex/regex.util.spec.js.map +1 -0
- package/build/_collections/utils/regex/username-regex.util.spec.d.ts +2 -0
- package/build/_collections/utils/regex/username-regex.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/regex/username-regex.util.spec.js +59 -0
- package/build/_collections/utils/regex/username-regex.util.spec.js.map +1 -0
- package/build/_collections/utils/round-list.util.d.ts.map +1 -1
- package/build/_collections/utils/round-list.util.js +1 -1
- package/build/_collections/utils/round-list.util.js.map +1 -1
- package/build/_collections/utils/round-list.util.spec.d.ts +2 -0
- package/build/_collections/utils/round-list.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/round-list.util.spec.js +65 -0
- package/build/_collections/utils/round-list.util.spec.js.map +1 -0
- package/build/_collections/utils/shared.util.spec.d.ts +2 -0
- package/build/_collections/utils/shared.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/shared.util.spec.js +113 -0
- package/build/_collections/utils/shared.util.spec.js.map +1 -0
- package/build/_collections/utils/string.util.d.ts +5 -0
- package/build/_collections/utils/string.util.d.ts.map +1 -0
- package/build/_collections/utils/string.util.js +11 -0
- package/build/_collections/utils/string.util.js.map +1 -0
- package/build/_collections/utils/string.util.spec.d.ts +2 -0
- package/build/_collections/utils/string.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/string.util.spec.js +36 -0
- package/build/_collections/utils/string.util.spec.js.map +1 -0
- package/build/_collections/utils/type-cloning-facility.util.spec.d.ts +2 -0
- package/build/_collections/utils/type-cloning-facility.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/type-cloning-facility.util.spec.js +41 -0
- package/build/_collections/utils/type-cloning-facility.util.spec.js.map +1 -0
- package/build/_collections/utils/utilities.util.d.ts +0 -8
- package/build/_collections/utils/utilities.util.d.ts.map +1 -1
- package/build/_collections/utils/utilities.util.js +0 -8
- package/build/_collections/utils/utilities.util.js.map +1 -1
- package/build/_collections/utils/utilities.util.spec.d.ts +2 -0
- package/build/_collections/utils/utilities.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/utilities.util.spec.js +145 -0
- package/build/_collections/utils/utilities.util.spec.js.map +1 -0
- package/build/_collections/utils/uuid.util.d.ts +0 -1
- package/build/_collections/utils/uuid.util.d.ts.map +1 -1
- package/build/_collections/utils/uuid.util.js +1 -1
- package/build/_collections/utils/uuid.util.js.map +1 -1
- package/build/_collections/utils/uuid.util.spec.d.ts +2 -0
- package/build/_collections/utils/uuid.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/uuid.util.spec.js +29 -0
- package/build/_collections/utils/uuid.util.spec.js.map +1 -0
- package/build/_models/control-models/data-model-params.control-model.spec.d.ts +2 -0
- package/build/_models/control-models/data-model-params.control-model.spec.d.ts.map +1 -0
- package/build/_models/control-models/data-model-params.control-model.spec.js +53 -0
- package/build/_models/control-models/data-model-params.control-model.spec.js.map +1 -0
- package/build/_models/control-models/data-property-params.control-model.spec.d.ts +2 -0
- package/build/_models/control-models/data-property-params.control-model.spec.d.ts.map +1 -0
- package/build/_models/control-models/data-property-params.control-model.spec.js +83 -0
- package/build/_models/control-models/data-property-params.control-model.spec.js.map +1 -0
- package/build/_models/control-models/poll.control-model.d.ts +7 -7
- package/build/_models/control-models/poll.control-model.d.ts.map +1 -1
- package/build/_models/control-models/poll.control-model.js.map +1 -1
- package/build/_models/control-models/poll.control-model.spec.d.ts +2 -0
- package/build/_models/control-models/poll.control-model.spec.d.ts.map +1 -0
- package/build/_models/control-models/poll.control-model.spec.js +57 -0
- package/build/_models/control-models/poll.control-model.spec.js.map +1 -0
- package/build/_models/control-models/range-value.control-model.spec.d.ts +2 -0
- package/build/_models/control-models/range-value.control-model.spec.d.ts.map +1 -0
- package/build/_models/control-models/range-value.control-model.spec.js +163 -0
- package/build/_models/control-models/range-value.control-model.spec.js.map +1 -0
- package/build/_models/data-models/metadata.data-model.spec.d.ts +2 -0
- package/build/_models/data-models/metadata.data-model.spec.d.ts.map +1 -0
- package/build/_models/data-models/metadata.data-model.spec.js +102 -0
- package/build/_models/data-models/metadata.data-model.spec.js.map +1 -0
- package/build/_models/interfaces/search-query.interface.d.ts +2 -2
- package/build/_models/interfaces/search-query.interface.d.ts.map +1 -1
- package/build/_models/interfaces/search-result.interface.d.ts +5 -0
- package/build/_models/interfaces/search-result.interface.d.ts.map +1 -0
- package/build/_models/interfaces/search-result.interface.js +3 -0
- package/build/_models/interfaces/search-result.interface.js.map +1 -0
- package/build/_modules/custom-data/_models/cud.data-model.spec.d.ts +2 -0
- package/build/_modules/custom-data/_models/cud.data-model.spec.d.ts.map +1 -0
- package/build/_modules/custom-data/_models/cud.data-model.spec.js +34 -0
- package/build/_modules/custom-data/_models/cud.data-model.spec.js.map +1 -0
- package/build/_modules/location/_collections/loc-regions.util.spec.d.ts +2 -0
- package/build/_modules/location/_collections/loc-regions.util.spec.d.ts.map +1 -0
- package/build/_modules/location/_collections/loc-regions.util.spec.js +51 -0
- package/build/_modules/location/_collections/loc-regions.util.spec.js.map +1 -0
- package/build/_modules/location/_collections/loc.util.spec.d.ts +2 -0
- package/build/_modules/location/_collections/loc.util.spec.d.ts.map +1 -0
- package/build/_modules/location/_collections/loc.util.spec.js +39 -0
- package/build/_modules/location/_collections/loc.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js +33 -0
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js +36 -0
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js +35 -0
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js +31 -0
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js +54 -0
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js +26 -0
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js +50 -0
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js +23 -0
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js +38 -0
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js +20 -0
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.d.ts +2 -0
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.d.ts.map +1 -0
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js +49 -0
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js.map +1 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.d.ts +2 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.d.ts.map +1 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.js +54 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.js.map +1 -0
- package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.js +2 -2
- package/build/_modules/socket/_models/sck-socket-event.control-model.js.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.d.ts +2 -0
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.d.ts.map +1 -0
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js +49 -0
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js.map +1 -0
- package/build/_modules/socket/_services/sck-client.service-base.d.ts +3 -3
- package/build/_modules/socket/_services/sck-client.service-base.d.ts.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.js +3 -3
- package/build/_modules/socket/_services/sck-client.service-base.js.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.spec.d.ts +2 -0
- package/build/_modules/socket/_services/sck-client.service-base.spec.d.ts.map +1 -0
- package/build/_modules/socket/_services/sck-client.service-base.spec.js +82 -0
- package/build/_modules/socket/_services/sck-client.service-base.spec.js.map +1 -0
- package/build/_modules/usage/_models/usg-action.control-model.spec.d.ts +2 -0
- package/build/_modules/usage/_models/usg-action.control-model.spec.d.ts.map +1 -0
- package/build/_modules/usage/_models/usg-action.control-model.spec.js +24 -0
- package/build/_modules/usage/_models/usg-action.control-model.spec.js.map +1 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.d.ts +2 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.d.ts.map +1 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js +33 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js.map +1 -0
- package/build/_modules/usage/_models/usg-data.control-model.spec.d.ts +2 -0
- package/build/_modules/usage/_models/usg-data.control-model.spec.d.ts.map +1 -0
- package/build/_modules/usage/_models/usg-data.control-model.spec.js +37 -0
- package/build/_modules/usage/_models/usg-data.control-model.spec.js.map +1 -0
- package/build/_modules/usage/_models/usg-session.data-model.spec.d.ts +2 -0
- package/build/_modules/usage/_models/usg-session.data-model.spec.d.ts.map +1 -0
- package/build/_modules/usage/_models/usg-session.data-model.spec.js +66 -0
- package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.10.02.tgz +0 -0
- package/package.json +11 -23
- package/src/_collections/utils/array.util.spec.ts +0 -45
- package/src/_collections/utils/array.util.ts +2 -45
- package/src/_collections/utils/log.util.spec.ts +99 -0
- package/src/_collections/utils/log.util.ts +4 -0
- package/src/_collections/utils/math/box-bounds.util.spec.ts +63 -0
- package/src/_collections/utils/math/math.util.spec.ts +104 -0
- package/src/_collections/utils/math/random.util.spec.ts +82 -0
- package/src/_collections/utils/math/trigonometry.util.spec.ts +57 -0
- package/src/_collections/utils/math/vector2.util.spec.ts +94 -0
- package/src/_collections/utils/regex/password-regex.util.spec.ts +51 -0
- package/src/_collections/utils/regex/regex.util.spec.ts +42 -0
- package/src/_collections/utils/regex/username-regex.util.spec.ts +61 -0
- package/src/_collections/utils/round-list.util.spec.ts +79 -0
- package/src/_collections/utils/round-list.util.ts +46 -1
- package/src/_collections/utils/shared.util.spec.ts +143 -0
- package/src/_collections/utils/string.util.spec.ts +41 -0
- package/src/_collections/utils/string.util.ts +10 -0
- package/src/_collections/utils/type-cloning-facility.util.spec.ts +51 -0
- package/src/_collections/utils/utilities.util.spec.ts +166 -0
- package/src/_collections/utils/utilities.util.ts +1 -12
- package/src/_collections/utils/uuid.util.spec.ts +30 -0
- package/src/_collections/utils/uuid.util.ts +14 -1
- package/src/_models/control-models/data-model-params.control-model.spec.ts +67 -0
- package/src/_models/control-models/data-property-params.control-model.spec.ts +109 -0
- package/src/_models/control-models/poll.control-model.spec.ts +63 -0
- package/src/_models/control-models/poll.control-model.ts +8 -7
- package/src/_models/control-models/range-value.control-model.spec.ts +187 -0
- package/src/_models/data-models/metadata.data-model.spec.ts +123 -0
- package/src/_models/interfaces/search-query.interface.ts +2 -2
- package/src/_models/interfaces/search-result.interface.ts +6 -0
- package/src/_modules/custom-data/_models/cud.data-model.spec.ts +38 -0
- package/src/_modules/location/_collections/loc-regions.util.spec.ts +61 -0
- package/src/_modules/location/_collections/loc.util.spec.ts +52 -0
- package/src/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.ts +47 -0
- package/src/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.ts +39 -0
- package/src/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.ts +41 -0
- package/src/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.ts +34 -0
- package/src/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.ts +60 -0
- package/src/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.ts +28 -0
- package/src/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.ts +59 -0
- package/src/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.ts +31 -0
- package/src/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.ts +44 -0
- package/src/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.ts +21 -0
- package/src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.ts +61 -0
- package/src/_modules/socket/_models/sck-client-params.control-model.spec.ts +67 -0
- package/src/_modules/socket/_models/sck-socket-event.control-model.spec.ts +66 -0
- package/src/_modules/socket/_models/sck-socket-event.control-model.ts +2 -2
- package/src/_modules/socket/_services/sck-client.service-base.spec.ts +99 -0
- package/src/_modules/socket/_services/sck-client.service-base.ts +7 -7
- package/src/_modules/usage/_models/usg-action.control-model.spec.ts +27 -0
- package/src/_modules/usage/_models/usg-daily-usage-data.control-model.spec.ts +36 -0
- package/src/_modules/usage/_models/usg-data.control-model.spec.ts +41 -0
- package/src/_modules/usage/_models/usg-session.data-model.spec.ts +73 -0
- package/src/index.ts +1 -0
- package/futdevpro-fsm-dynamo-01.09.51.tgz +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_RangeValue } from './range-value.control-model';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_RangeValue', () => {
|
|
5
|
+
it('should create an instance with the same from and to values when a single number is provided', () => {
|
|
6
|
+
const range = new DyFM_RangeValue(5);
|
|
7
|
+
expect(range.from).toBe(5);
|
|
8
|
+
expect(range.to).toBe(5);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should create an instance with different from and to values when two numbers are provided', () => {
|
|
12
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
13
|
+
expect(range.from).toBe(5);
|
|
14
|
+
expect(range.to).toBe(10);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should copy from and to values from another DyFM_RangeValue instance', () => {
|
|
18
|
+
const original = new DyFM_RangeValue(5, 10);
|
|
19
|
+
const copy = new DyFM_RangeValue(original);
|
|
20
|
+
expect(copy.from).toBe(5);
|
|
21
|
+
expect(copy.to).toBe(10);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should update from and to values using newValues method', () => {
|
|
25
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
26
|
+
const newRange = new DyFM_RangeValue(15, 20);
|
|
27
|
+
range.newValues(newRange);
|
|
28
|
+
expect(range.from).toBe(15);
|
|
29
|
+
expect(range.to).toBe(20);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should add a range to the current range', () => {
|
|
33
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
34
|
+
const addRange = new DyFM_RangeValue(2, 3);
|
|
35
|
+
range.addRange(addRange);
|
|
36
|
+
expect(range.from).toBe(7);
|
|
37
|
+
expect(range.to).toBe(13);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should subtract a range from the current range', () => {
|
|
41
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
42
|
+
const subtractRange = new DyFM_RangeValue(2, 3);
|
|
43
|
+
range.subtractRange(subtractRange);
|
|
44
|
+
expect(range.from).toBe(3);
|
|
45
|
+
expect(range.to).toBe(7);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should multiply the current range by another range', () => {
|
|
49
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
50
|
+
const multiplyRange = new DyFM_RangeValue(2, 3);
|
|
51
|
+
range.multiplyRange(multiplyRange);
|
|
52
|
+
expect(range.from).toBe(10);
|
|
53
|
+
expect(range.to).toBe(30);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should divide the current range by another range', () => {
|
|
57
|
+
const range = new DyFM_RangeValue(10, 20);
|
|
58
|
+
const divideRange = new DyFM_RangeValue(2, 4);
|
|
59
|
+
range.divideRange(divideRange);
|
|
60
|
+
expect(range.from).toBe(5);
|
|
61
|
+
expect(range.to).toBe(5);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should add a number to both from and to values', () => {
|
|
65
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
66
|
+
range.add(5);
|
|
67
|
+
expect(range.from).toBe(10);
|
|
68
|
+
expect(range.to).toBe(15);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should subtract a number from both from and to values', () => {
|
|
72
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
73
|
+
range.subtract(3);
|
|
74
|
+
expect(range.from).toBe(2);
|
|
75
|
+
expect(range.to).toBe(7);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should multiply both from and to values by a number', () => {
|
|
79
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
80
|
+
range.multiply(2);
|
|
81
|
+
expect(range.from).toBe(10);
|
|
82
|
+
expect(range.to).toBe(20);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should divide both from and to values by a number', () => {
|
|
86
|
+
const range = new DyFM_RangeValue(10, 20);
|
|
87
|
+
range.divide(2);
|
|
88
|
+
expect(range.from).toBe(5);
|
|
89
|
+
expect(range.to).toBe(10);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should clone the range', () => {
|
|
93
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
94
|
+
const clone = range.clone();
|
|
95
|
+
expect(clone.from).toBe(5);
|
|
96
|
+
expect(clone.to).toBe(10);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should apply a transformation to both from and to values', () => {
|
|
100
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
101
|
+
const transformed = range.applyTransform(value => value * 2);
|
|
102
|
+
expect(transformed.from).toBe(10);
|
|
103
|
+
expect(transformed.to).toBe(20);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should stringify the range with spaces', () => {
|
|
107
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
108
|
+
expect(range.stringify()).toBe('5 - 10');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('should stringify the range without spaces', () => {
|
|
112
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
113
|
+
expect(range.stringify(false)).toBe('5-10');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should auto-stringify when from and to are equal', () => {
|
|
117
|
+
const range = new DyFM_RangeValue(5, 5);
|
|
118
|
+
expect(range.stringify()).toBe('5');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should retype a range value', () => {
|
|
122
|
+
const range = new DyFM_RangeValue(5, 10);
|
|
123
|
+
const retyped = DyFM_RangeValue.reType(range);
|
|
124
|
+
expect(retyped.from).toBe(5);
|
|
125
|
+
expect(retyped.to).toBe(10);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should add two ranges statically', () => {
|
|
129
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
130
|
+
const b = new DyFM_RangeValue(2, 3);
|
|
131
|
+
const result = DyFM_RangeValue.addRange(a, b);
|
|
132
|
+
expect(result.from).toBe(7);
|
|
133
|
+
expect(result.to).toBe(13);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should subtract two ranges statically', () => {
|
|
137
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
138
|
+
const b = new DyFM_RangeValue(2, 3);
|
|
139
|
+
const result = DyFM_RangeValue.subtractRange(a, b);
|
|
140
|
+
expect(result.from).toBe(3);
|
|
141
|
+
expect(result.to).toBe(7);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should multiply two ranges statically', () => {
|
|
145
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
146
|
+
const b = new DyFM_RangeValue(2, 3);
|
|
147
|
+
const result = DyFM_RangeValue.multiplyRange(a, b);
|
|
148
|
+
expect(result.from).toBe(10);
|
|
149
|
+
expect(result.to).toBe(30);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should divide two ranges statically', () => {
|
|
153
|
+
const a = new DyFM_RangeValue(10, 20);
|
|
154
|
+
const b = new DyFM_RangeValue(2, 4);
|
|
155
|
+
const result = DyFM_RangeValue.divideRange(a, b);
|
|
156
|
+
expect(result.from).toBe(5);
|
|
157
|
+
expect(result.to).toBe(5);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should add a number to a range statically', () => {
|
|
161
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
162
|
+
const result = DyFM_RangeValue.add(a, 5);
|
|
163
|
+
expect(result.from).toBe(10);
|
|
164
|
+
expect(result.to).toBe(15);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should subtract a number from a range statically', () => {
|
|
168
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
169
|
+
const result = DyFM_RangeValue.subtract(a, 3);
|
|
170
|
+
expect(result.from).toBe(2);
|
|
171
|
+
expect(result.to).toBe(7);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('should multiply a range by a number statically', () => {
|
|
175
|
+
const a = new DyFM_RangeValue(5, 10);
|
|
176
|
+
const result = DyFM_RangeValue.multiply(a, 2);
|
|
177
|
+
expect(result.from).toBe(10);
|
|
178
|
+
expect(result.to).toBe(20);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should divide a range by a number statically', () => {
|
|
182
|
+
const a = new DyFM_RangeValue(10, 20);
|
|
183
|
+
const result = DyFM_RangeValue.divide(a, 2);
|
|
184
|
+
expect(result.from).toBe(5);
|
|
185
|
+
expect(result.to).toBe(10);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_Metadata } from './metadata.data-model';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_Metadata', () => {
|
|
5
|
+
describe('constructor', () => {
|
|
6
|
+
it('should initialize with default values when no parameters are provided', () => {
|
|
7
|
+
const metadata = new DyFM_Metadata();
|
|
8
|
+
|
|
9
|
+
expect(metadata._id).toBeUndefined();
|
|
10
|
+
expect(metadata.__created).toBeDefined();
|
|
11
|
+
expect(metadata.__createdBy).toBeUndefined();
|
|
12
|
+
expect(metadata.__lastModified).toBeDefined();
|
|
13
|
+
expect(metadata.__lastModifiedBy).toBeUndefined();
|
|
14
|
+
expect(metadata.__v).toBe(0);
|
|
15
|
+
expect(metadata._deleted).toBeUndefined();
|
|
16
|
+
expect(metadata._archived).toBeUndefined();
|
|
17
|
+
expect(metadata._originalId).toBeUndefined();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should initialize with provided set values', () => {
|
|
21
|
+
const set: DyFM_Metadata = {
|
|
22
|
+
_id: '123',
|
|
23
|
+
__created: new Date('2023-01-01'),
|
|
24
|
+
__createdBy: 'creator',
|
|
25
|
+
__lastModified: new Date('2023-01-02'),
|
|
26
|
+
__lastModifiedBy: 'modifier',
|
|
27
|
+
__v: 1,
|
|
28
|
+
_archived: new Date('2023-01-03'),
|
|
29
|
+
_originalId: 'orig-123'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const metadata = new DyFM_Metadata(set);
|
|
33
|
+
|
|
34
|
+
expect(metadata._id).toBe('123');
|
|
35
|
+
expect(metadata.__created).toEqual(new Date('2023-01-01'));
|
|
36
|
+
expect(metadata.__createdBy).toBe('creator');
|
|
37
|
+
expect(metadata.__lastModified).toEqual(new Date('2023-01-02'));
|
|
38
|
+
expect(metadata.__lastModifiedBy).toBe('modifier');
|
|
39
|
+
expect(metadata.__v).toBe(1);
|
|
40
|
+
expect(metadata._archived).toEqual(new Date('2023-01-03'));
|
|
41
|
+
expect(metadata._originalId).toBe('orig-123');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should initialize with provided init values', () => {
|
|
45
|
+
const init = {
|
|
46
|
+
id: '456',
|
|
47
|
+
issuer: 'issuer'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const metadata = new DyFM_Metadata(undefined, init);
|
|
51
|
+
|
|
52
|
+
expect(metadata._id).toBe('456');
|
|
53
|
+
expect(metadata.__createdBy).toBe('issuer');
|
|
54
|
+
expect(metadata.__lastModifiedBy).toBe('issuer');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should prioritize set values over init values', () => {
|
|
58
|
+
const set: DyFM_Metadata = {
|
|
59
|
+
_id: '123',
|
|
60
|
+
__createdBy: 'creator',
|
|
61
|
+
__lastModifiedBy: 'modifier'
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const init = {
|
|
65
|
+
id: '456',
|
|
66
|
+
issuer: 'issuer'
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const metadata = new DyFM_Metadata(set, init);
|
|
70
|
+
|
|
71
|
+
expect(metadata._id).toBe('123');
|
|
72
|
+
expect(metadata.__createdBy).toBe('creator');
|
|
73
|
+
expect(metadata.__lastModifiedBy).toBe('modifier');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('updateMetadata', () => {
|
|
78
|
+
it('should update metadata with new values', () => {
|
|
79
|
+
const data: DyFM_Metadata = {
|
|
80
|
+
_id: '789',
|
|
81
|
+
__created: new Date('2023-01-01'),
|
|
82
|
+
__createdBy: 'creator',
|
|
83
|
+
__lastModified: new Date('2023-01-02'),
|
|
84
|
+
__lastModifiedBy: 'modifier',
|
|
85
|
+
__v: 1
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const updatedData = DyFM_Metadata.updateMetadata(data, 'newIssuer', '789');
|
|
89
|
+
|
|
90
|
+
expect(updatedData._id).toBe('789');
|
|
91
|
+
expect(updatedData.__created).toEqual(new Date('2023-01-01'));
|
|
92
|
+
expect(updatedData.__createdBy).toBe('creator');
|
|
93
|
+
expect(updatedData.__lastModified).toBeDefined();
|
|
94
|
+
expect(updatedData.__lastModifiedBy).toBe('newIssuer');
|
|
95
|
+
expect(updatedData.__v).toBe(2);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should throw an error if data is deleted', () => {
|
|
99
|
+
const data: DyFM_Metadata = {
|
|
100
|
+
_deleted: new Date()
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
expect(() => DyFM_Metadata.updateMetadata(data, 'issuer')).toThrowError('Cannot update metadata of deleted data');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should set new id if not present and id is provided', () => {
|
|
107
|
+
const data: DyFM_Metadata = {};
|
|
108
|
+
|
|
109
|
+
const updatedData = DyFM_Metadata.updateMetadata(data, 'issuer', 'new-id');
|
|
110
|
+
|
|
111
|
+
expect(updatedData._id).toBe('new-id');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('should set created and createdBy if not present', () => {
|
|
115
|
+
const data: DyFM_Metadata = {};
|
|
116
|
+
|
|
117
|
+
const updatedData = DyFM_Metadata.updateMetadata(data, 'issuer');
|
|
118
|
+
|
|
119
|
+
expect(updatedData.__created).toBeDefined();
|
|
120
|
+
expect(updatedData.__createdBy).toBe('issuer');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { DyFM_DBFilterSimple } from '../types/db-filter.type';
|
|
3
3
|
import { DyFM_DBSort } from '../types/db-sort.type';
|
|
4
4
|
|
|
5
5
|
export interface DyFM_SearchQuery<T> {
|
|
6
|
-
filterBy?: DyFM_DBFilter<T>;
|
|
6
|
+
filterBy?: DyFM_DBFilterSimple<T>; //DyFM_DBFilter<T>;
|
|
7
7
|
sortBy?: DyFM_DBSort<T>;
|
|
8
8
|
page?: number;
|
|
9
9
|
pageSize?: number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_CustomData, DyFM_customData_dataParams } from './cud.data-model';
|
|
3
|
+
import { DyFM_DataModel_Params } from '../../../_models/control-models/data-model-params.control-model';
|
|
4
|
+
import { DyFM_Metadata } from '../../../_models/data-models/metadata.data-model';
|
|
5
|
+
|
|
6
|
+
describe('DyFM_CustomData', () => {
|
|
7
|
+
it('should create an instance without initial data', () => {
|
|
8
|
+
const instance = new DyFM_CustomData();
|
|
9
|
+
expect(instance).toBeTruthy();
|
|
10
|
+
expect(instance.data).toBeUndefined();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should create an instance with initial data', () => {
|
|
14
|
+
const initialData = { data: 'testData' };
|
|
15
|
+
const instance = new DyFM_CustomData(initialData);
|
|
16
|
+
expect(instance).toBeTruthy();
|
|
17
|
+
expect(instance.data).toEqual('testData');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should assign properties from the set parameter', () => {
|
|
21
|
+
const initialData = { data: 'testData' };
|
|
22
|
+
const instance = new DyFM_CustomData(initialData);
|
|
23
|
+
expect(instance.data).toEqual(initialData.data);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('DyFM_customData_dataParams', () => {
|
|
28
|
+
it('should have correct dataName and properties', () => {
|
|
29
|
+
expect(DyFM_customData_dataParams.dataName).toEqual('customData');
|
|
30
|
+
expect(DyFM_customData_dataParams.properties).toEqual({
|
|
31
|
+
data: { key: 'data', type: 'string', required: true },
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should be an instance of DyFM_DataModel_Params', () => {
|
|
36
|
+
expect(DyFM_customData_dataParams).toBeInstanceOf(DyFM_DataModel_Params);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_Region } from '../_enums/loc-region.enum';
|
|
3
|
+
import { DyFM_CountryDivision } from '../_models/loc-country-division.interface';
|
|
4
|
+
import { DyFM_CountryISO } from '../_models/loc-country-iso.interface';
|
|
5
|
+
import { DyFM_CountryPhoneCode } from '../_models/loc-country-phone-code.interface';
|
|
6
|
+
import { DyFM_Regions } from './loc-regions.util';
|
|
7
|
+
|
|
8
|
+
describe('DyFM_Regions', () => {
|
|
9
|
+
it('should get all country ISOs', () => {
|
|
10
|
+
const countryISOs: DyFM_CountryISO[] = DyFM_Regions.countryISOs;
|
|
11
|
+
expect(countryISOs).toBeDefined();
|
|
12
|
+
expect(countryISOs.length).toBeGreaterThan(0);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should get all phone codes', () => {
|
|
16
|
+
const phoneCodes: DyFM_CountryPhoneCode[] = DyFM_Regions.phoneCodes;
|
|
17
|
+
expect(phoneCodes).toBeDefined();
|
|
18
|
+
expect(phoneCodes.length).toBeGreaterThan(0);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should get all divisions', () => {
|
|
22
|
+
const divisions: DyFM_CountryDivision[] = DyFM_Regions.divisions;
|
|
23
|
+
expect(divisions).toBeDefined();
|
|
24
|
+
expect(divisions.length).toBeGreaterThan(0);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should convert ISO to country ISO', () => {
|
|
28
|
+
const iso2 = 'US';
|
|
29
|
+
const countryISO: DyFM_CountryISO = DyFM_Regions.isoToCountryIso(iso2);
|
|
30
|
+
expect(countryISO).toBeDefined();
|
|
31
|
+
expect(countryISO.iso2).toBe(iso2);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/* it('should throw error if ISO not found in isoToCountryIso', () => {
|
|
35
|
+
const iso2 = 'XX';
|
|
36
|
+
expect(() => DyFM_Regions.isoToCountryIso(iso2)).toThrowError(DyFM_Error);
|
|
37
|
+
});
|
|
38
|
+
*/
|
|
39
|
+
it('should convert ISO to region', () => {
|
|
40
|
+
const iso2 = 'US';
|
|
41
|
+
const region: DyFM_Region = DyFM_Regions.isoToRegion(iso2);
|
|
42
|
+
expect(region).toBeDefined();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/* it('should throw error if ISO not found in isoToRegion', () => {
|
|
46
|
+
const iso2 = 'XX';
|
|
47
|
+
expect(() => DyFM_Regions.isoToRegion(iso2)).toThrowError(DyFM_Error);
|
|
48
|
+
}); */
|
|
49
|
+
|
|
50
|
+
it('should convert ISO to phone code', () => {
|
|
51
|
+
const iso2 = 'US';
|
|
52
|
+
const phoneCode: DyFM_CountryPhoneCode = DyFM_Regions.isoToPhoneCode(iso2);
|
|
53
|
+
expect(phoneCode).toBeDefined();
|
|
54
|
+
expect(phoneCode.iso).toBe(iso2);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/* it('should throw error if ISO not found in isoToPhoneCode', () => {
|
|
58
|
+
const iso2 = 'XX';
|
|
59
|
+
expect(() => DyFM_Regions.isoToPhoneCode(iso2)).toThrowError(DyFM_Error);
|
|
60
|
+
}); */
|
|
61
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_LocationCoordinates } from '../_models/loc-coordinates.interface';
|
|
3
|
+
import { DyFM_Location } from './loc.util';
|
|
4
|
+
|
|
5
|
+
describe('DyFM_Location', () => {
|
|
6
|
+
|
|
7
|
+
describe('getDistanceInKilometres', () => {
|
|
8
|
+
xit('should calculate the correct distance between two coordinates', () => {
|
|
9
|
+
const from: DyFM_LocationCoordinates = { latitude: 52.5200, longitude: 13.4050 }; // Berlin
|
|
10
|
+
const to: DyFM_LocationCoordinates = { latitude: 48.8566, longitude: 2.3522 }; // Paris
|
|
11
|
+
|
|
12
|
+
const distance = DyFM_Location.getDistanceInKilometres(from, to);
|
|
13
|
+
|
|
14
|
+
expect(distance).toBeCloseTo(878.7, 1); // Approximate distance in km
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return 0 when the coordinates are the same', () => {
|
|
18
|
+
const from: DyFM_LocationCoordinates = { latitude: 52.5200, longitude: 13.4050 };
|
|
19
|
+
|
|
20
|
+
const distance = DyFM_Location.getDistanceInKilometres(from, from);
|
|
21
|
+
|
|
22
|
+
expect(distance).toBe(0);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('getLocationDegByKilometers', () => {
|
|
27
|
+
it('should calculate the correct degree change for latitude', () => {
|
|
28
|
+
const distanceInKm = 110.574; // 1 degree of latitude
|
|
29
|
+
|
|
30
|
+
const degreeChange = DyFM_Location.getLocationDegByKilometers('latitude', distanceInKm);
|
|
31
|
+
|
|
32
|
+
expect(degreeChange).toBeCloseTo(1, 5);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
xit('should calculate the correct degree change for longitude', () => {
|
|
36
|
+
const distanceInKm = 111.320; // Approximate 1 degree of longitude at the equator
|
|
37
|
+
const latitude = 0; // Equator
|
|
38
|
+
|
|
39
|
+
const degreeChange = DyFM_Location.getLocationDegByKilometers('longitude', distanceInKm, latitude);
|
|
40
|
+
|
|
41
|
+
expect(degreeChange).toBeCloseTo(1, 5);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/* it('should throw an error when calculating longitude without latitude', () => {
|
|
45
|
+
const distanceInKm = 111.320;
|
|
46
|
+
|
|
47
|
+
expect(() => {
|
|
48
|
+
DyFM_Location.getLocationDegByKilometers('longitude', distanceInKm);
|
|
49
|
+
}).toThrowError(DyFM_Error);
|
|
50
|
+
}); */
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_country_pipeTransform } from './pip-country-pipe.util';
|
|
3
|
+
import { DyFM_countryISOs } from '../../../location/_collections/loc-country-isos.const';
|
|
4
|
+
import { DyFM_CountryISO } from '../../../location/_models/loc-country-iso.interface';
|
|
5
|
+
|
|
6
|
+
describe('DyFM_country_pipeTransform', () => {
|
|
7
|
+
it('should return the country name when a valid ISO code is provided', () => {
|
|
8
|
+
const validISO: string = DyFM_countryISOs[0].iso2;
|
|
9
|
+
const expectedName: string = DyFM_countryISOs[0].name;
|
|
10
|
+
|
|
11
|
+
const result: string = DyFM_country_pipeTransform(validISO);
|
|
12
|
+
|
|
13
|
+
expect(result).toBe(expectedName);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return the input ISO code when an invalid ISO code is provided', () => {
|
|
17
|
+
const invalidISO: string = 'ZZ';
|
|
18
|
+
|
|
19
|
+
const result: string = DyFM_country_pipeTransform(invalidISO);
|
|
20
|
+
|
|
21
|
+
expect(result).toBe(invalidISO);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return the input ISO code when an empty string is provided', () => {
|
|
25
|
+
const emptyISO: string = '';
|
|
26
|
+
|
|
27
|
+
const result: string = DyFM_country_pipeTransform(emptyISO);
|
|
28
|
+
|
|
29
|
+
expect(result).toBe(emptyISO);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return the input ISO code when a null value is provided', () => {
|
|
33
|
+
const nullISO: string = null as unknown as string;
|
|
34
|
+
|
|
35
|
+
const result: string = DyFM_country_pipeTransform(nullISO);
|
|
36
|
+
|
|
37
|
+
expect(result).toBe(nullISO);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should return the input ISO code when an undefined value is provided', () => {
|
|
41
|
+
const undefinedISO: string = undefined as unknown as string;
|
|
42
|
+
|
|
43
|
+
const result: string = DyFM_country_pipeTransform(undefinedISO);
|
|
44
|
+
|
|
45
|
+
expect(result).toBe(undefinedISO);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_custom_pipeTransform } from './pip-custom-pipe.util';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_custom_pipeTransform', () => {
|
|
5
|
+
it('should apply the custom transform function to the input value', () => {
|
|
6
|
+
const input = 5;
|
|
7
|
+
const transformFunction = (x: number) => x * 2;
|
|
8
|
+
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
9
|
+
expect(result).toBe(10);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should handle string transformations correctly', () => {
|
|
13
|
+
const input = 'hello';
|
|
14
|
+
const transformFunction = (x: string) => x.toUpperCase();
|
|
15
|
+
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
16
|
+
expect(result).toBe('HELLO');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should handle object transformations correctly', () => {
|
|
20
|
+
const input = { name: 'Alice', age: 30 };
|
|
21
|
+
const transformFunction = (x: { name: string; age: number }) => ({ ...x, age: x.age + 1 });
|
|
22
|
+
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
23
|
+
expect(result).toEqual({ name: 'Alice', age: 31 });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should handle array transformations correctly', () => {
|
|
27
|
+
const input = [1, 2, 3];
|
|
28
|
+
const transformFunction = (x: number[]) => x.map(num => num * 2);
|
|
29
|
+
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
30
|
+
expect(result).toEqual([2, 4, 6]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should return undefined if the transform function returns undefined', () => {
|
|
34
|
+
const input = 'test';
|
|
35
|
+
const transformFunction = (x: string) => undefined;
|
|
36
|
+
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
37
|
+
expect(result).toBeUndefined();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_division_pipeTransform } from './pip-division-pipe.util';
|
|
3
|
+
import { DyFM_CountryDivision } from '../../../location/_models/loc-country-division.interface';
|
|
4
|
+
import { DyFM_countryDivisions } from '../../../location/_collections/loc-country-divisions.const';
|
|
5
|
+
|
|
6
|
+
describe('DyFM_division_pipeTransform', () => {
|
|
7
|
+
const mockCountryDivisions: DyFM_CountryDivision[] = [
|
|
8
|
+
{ code: 'CA', iso: 'US', name: 'California' },
|
|
9
|
+
{ code: 'TX', iso: 'US', name: 'Texas' },
|
|
10
|
+
{ code: 'ON', iso: 'CA', name: 'Ontario' }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
(DyFM_countryDivisions as DyFM_CountryDivision[]) = mockCountryDivisions;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return the name of the division when a matching division code and country ISO are found', () => {
|
|
18
|
+
const result = DyFM_division_pipeTransform('CA', 'US');
|
|
19
|
+
expect(result).toBe('California');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should return the division code when no matching division is found', () => {
|
|
23
|
+
const result = DyFM_division_pipeTransform('NY', 'US');
|
|
24
|
+
expect(result).toBe('NY');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should return the division code when the country ISO does not match', () => {
|
|
28
|
+
const result = DyFM_division_pipeTransform('CA', 'CA');
|
|
29
|
+
expect(result).toBe('CA');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return the division code when the division code is not found', () => {
|
|
33
|
+
const result = DyFM_division_pipeTransform('BC', 'CA');
|
|
34
|
+
expect(result).toBe('BC');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should handle empty division code and country ISO gracefully', () => {
|
|
38
|
+
const result = DyFM_division_pipeTransform('', '');
|
|
39
|
+
expect(result).toBe('');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_list_pipeTransform } from './pip-list-pipe.util';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_list_pipeTransform', () => {
|
|
5
|
+
it('should transform an array of numbers into a comma-separated string with spaces', () => {
|
|
6
|
+
const input: number[] = [1, 2, 3];
|
|
7
|
+
const expectedOutput: string = '1, 2, 3';
|
|
8
|
+
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should transform an array of strings into a comma-separated string with spaces', () => {
|
|
12
|
+
const input: string[] = ['apple', 'banana', 'cherry'];
|
|
13
|
+
const expectedOutput: string = 'apple, banana, cherry';
|
|
14
|
+
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return an empty string for an empty array', () => {
|
|
18
|
+
const input: any[] = [];
|
|
19
|
+
const expectedOutput: string = '';
|
|
20
|
+
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should handle an array with a single element correctly', () => {
|
|
24
|
+
const input: number[] = [42];
|
|
25
|
+
const expectedOutput: string = '42';
|
|
26
|
+
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should handle an array with mixed types correctly', () => {
|
|
30
|
+
const input: any[] = [1, 'apple', true];
|
|
31
|
+
const expectedOutput: string = '1, apple, true';
|
|
32
|
+
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
33
|
+
});
|
|
34
|
+
});
|