@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,60 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
DyFM_AngularMultiPipeAvailable
|
|
4
|
+
} from '../../_enums/pip.enum';
|
|
5
|
+
import { DyFM_MultiPipe_Setting } from '../../_models/pip-multi-pipe-settings.type';
|
|
6
|
+
import { DyFM_multiPipe_pipeTransform, DyFM_multiPipeAngularPipes } from './pip-multi-pipe-pipe.util';
|
|
7
|
+
|
|
8
|
+
describe('DyFM_multiPipe_pipeTransform', () => {
|
|
9
|
+
it('should return the original value if no pipes are provided', () => {
|
|
10
|
+
const value = 'test';
|
|
11
|
+
const pipes: DyFM_MultiPipe_Setting[] = [];
|
|
12
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/* it('should return the original value if pipe has more than one key', () => {
|
|
16
|
+
const value = 'test';
|
|
17
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ pipe1: [], pipe2: [] }];
|
|
18
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should return the original value if pipe is not available', () => {
|
|
22
|
+
const value = 'test';
|
|
23
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ unknownPipe: [] }];
|
|
24
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should transform value using a known pipe without arguments', () => {
|
|
28
|
+
const value = 'test';
|
|
29
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: [] }];
|
|
30
|
+
DyFM_pipeTransforms[DyFM_Pipe.currency] = (val: unknown) => 'transformed';
|
|
31
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe('transformed');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should transform value using a known pipe with arguments', () => {
|
|
35
|
+
const value = 'test';
|
|
36
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: ['arg1'] }];
|
|
37
|
+
DyFM_pipeTransforms[DyFM_Pipe.currency] = (val: unknown, arg: string) => `transformed with ${arg}`;
|
|
38
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe('transformed with arg1');
|
|
39
|
+
}); */
|
|
40
|
+
|
|
41
|
+
xit('should return the original value if Angular pipe is not defined', () => {
|
|
42
|
+
const value = 'test';
|
|
43
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_AngularMultiPipeAvailable.currency]: [] }];
|
|
44
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should transform value using a defined Angular pipe', () => {
|
|
48
|
+
const value = 'test';
|
|
49
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_AngularMultiPipeAvailable.currency]: ['arg1'] }];
|
|
50
|
+
DyFM_multiPipeAngularPipes[DyFM_AngularMultiPipeAvailable.currency] = (val: string, arg: string) => `angular transformed with ${arg}`;
|
|
51
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe('angular transformed with arg1');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/* it('should handle errors gracefully and return the original value', () => {
|
|
55
|
+
const value = 'test';
|
|
56
|
+
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: [] }];
|
|
57
|
+
DyFM_pipeTransforms[DyFM_Pipe.currency] = () => { throw new Error('Test error'); };
|
|
58
|
+
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
59
|
+
}); */
|
|
60
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_objKey_pipeTransform } from './pip-obj-key-pipe.util';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_objKey_pipeTransform', () => {
|
|
5
|
+
it('should return an array of keys when an object is provided', () => {
|
|
6
|
+
const input = { a: 1, b: 2, c: 3 };
|
|
7
|
+
const expectedOutput = ['a', 'b', 'c'];
|
|
8
|
+
expect(DyFM_objKey_pipeTransform(input)).toEqual(expectedOutput);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should return an empty array when null is provided', () => {
|
|
12
|
+
const input = null;
|
|
13
|
+
const expectedOutput: string[] = [];
|
|
14
|
+
expect(DyFM_objKey_pipeTransform(input)).toEqual(expectedOutput);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return an empty array when undefined is provided', () => {
|
|
18
|
+
const input = undefined;
|
|
19
|
+
const expectedOutput: string[] = [];
|
|
20
|
+
expect(DyFM_objKey_pipeTransform(input)).toEqual(expectedOutput);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should return an empty array when an empty object is provided', () => {
|
|
24
|
+
const input = {};
|
|
25
|
+
const expectedOutput: string[] = [];
|
|
26
|
+
expect(DyFM_objKey_pipeTransform(input)).toEqual(expectedOutput);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_RangeValue } from '../../../../_models/control-models/range-value.control-model';
|
|
3
|
+
import { DyFM_RangePipe_Setting } from '../../_enums/pip-range-pipe-setting.enum';
|
|
4
|
+
import { DyFM_MultiPipe_Setting } from '../../_models/pip-multi-pipe-settings.type';
|
|
5
|
+
import { DyFM_range_pipeTransform } from './pip-range-pipe.util';
|
|
6
|
+
|
|
7
|
+
describe('DyFM_range_pipeTransform', () => {
|
|
8
|
+
const mockMultiPipeTransform = (value: number, multiPipes: DyFM_MultiPipe_Setting[]) => {
|
|
9
|
+
return value.toString();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
spyOn(console, 'warn');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return the average of from and to when setting is avg or average', () => {
|
|
17
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
18
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.avg)).toBe(15);
|
|
19
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.average)).toBe(15);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should return from when setting is min or from', () => {
|
|
23
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
24
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.min)).toBe(10);
|
|
25
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.from)).toBe(10);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should return to when setting is max or to', () => {
|
|
29
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
30
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.max)).toBe(20);
|
|
31
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.to)).toBe(20);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should return formatted string when setting is both or fromTo', () => {
|
|
35
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
36
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.both)).toBe('10 - 20');
|
|
37
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.fromTo)).toBe('10 - 20');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/* it('should return transformed value using multiPipes when setting is both or fromTo and multiPipes are provided', () => {
|
|
41
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
42
|
+
const multiPipes: DyFM_MultiPipe_Setting[] = [{} as DyFM_MultiPipe_Setting];
|
|
43
|
+
spyOn(DyFM_multiPipe_pipeTransform, 'call').and.callFake(mockMultiPipeTransform);
|
|
44
|
+
|
|
45
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.both, multiPipes)).toBe('10 - 20');
|
|
46
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.fromTo, multiPipes)).toBe('10 - 20');
|
|
47
|
+
}); */
|
|
48
|
+
|
|
49
|
+
it('should return the original value if requirements are not met', () => {
|
|
50
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: false };
|
|
51
|
+
expect(DyFM_range_pipeTransform(value, DyFM_RangePipe_Setting.avg)).toBe(value);
|
|
52
|
+
expect(console.warn).toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return the original value for an unknown setting', () => {
|
|
56
|
+
const value: DyFM_RangeValue = { from: 10, to: 20, isRange: true };
|
|
57
|
+
expect(DyFM_range_pipeTransform(value, 'unknown')).toBe(value);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_region_pipeTransform } from './pip-region-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_region_pipeTransform', () => {
|
|
7
|
+
it('should return the region when a valid country ISO is provided', () => {
|
|
8
|
+
const validCountryISO = DyFM_countryISOs[0].iso2;
|
|
9
|
+
const expectedRegion = DyFM_countryISOs[0].region;
|
|
10
|
+
|
|
11
|
+
const result = DyFM_region_pipeTransform(validCountryISO);
|
|
12
|
+
|
|
13
|
+
expect(result).toBe(expectedRegion);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return the input country ISO when an invalid country ISO is provided', () => {
|
|
17
|
+
const invalidCountryISO = 'XX';
|
|
18
|
+
|
|
19
|
+
const result = DyFM_region_pipeTransform(invalidCountryISO);
|
|
20
|
+
|
|
21
|
+
expect(result).toBe(invalidCountryISO);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return the input country ISO when the country ISO is not found', () => {
|
|
25
|
+
const notFoundCountryISO = 'ZZ';
|
|
26
|
+
|
|
27
|
+
const result = DyFM_region_pipeTransform(notFoundCountryISO);
|
|
28
|
+
|
|
29
|
+
expect(result).toBe(notFoundCountryISO);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_replace_pipeTransform } from './pip-replace-pipe.util';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_replace_pipeTransform', () => {
|
|
5
|
+
it('should replace all occurrences of "from" with "to" in the given string', () => {
|
|
6
|
+
const result = DyFM_replace_pipeTransform('hello world', 'world', 'there');
|
|
7
|
+
expect(result).toBe('hello there');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should return the original string if "from" is not found', () => {
|
|
11
|
+
const result = DyFM_replace_pipeTransform('hello world', 'planet', 'there');
|
|
12
|
+
expect(result).toBe('hello world');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should handle empty "from" and "to" strings', () => {
|
|
16
|
+
const result = DyFM_replace_pipeTransform('hello world', '', '');
|
|
17
|
+
expect(result).toBe('hello world');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should handle empty "value" string', () => {
|
|
21
|
+
const result = DyFM_replace_pipeTransform('', 'world', 'there');
|
|
22
|
+
expect(result).toBe('');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should handle null "value" gracefully', () => {
|
|
26
|
+
const result = DyFM_replace_pipeTransform(null, 'world', 'there');
|
|
27
|
+
expect(result).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should handle undefined "value" gracefully', () => {
|
|
31
|
+
const result = DyFM_replace_pipeTransform(undefined, 'world', 'there');
|
|
32
|
+
expect(result).toBeUndefined();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should replace all occurrences when "from" is a substring of "value"', () => {
|
|
36
|
+
const result = DyFM_replace_pipeTransform('ababab', 'ab', 'cd');
|
|
37
|
+
expect(result).toBe('cdcdcd');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should return the original string if "from" and "to" are the same', () => {
|
|
41
|
+
const result = DyFM_replace_pipeTransform('hello world', 'world', 'world');
|
|
42
|
+
expect(result).toBe('hello world');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_slider_pipeTransform } from './pip-slider-pipe.util';
|
|
3
|
+
import { DyFM_RangeValue } from '../../../../_models/control-models/range-value.control-model';
|
|
4
|
+
|
|
5
|
+
describe('DyFM_slider_pipeTransform', () => {
|
|
6
|
+
it('should return the string representation of a DyFM_RangeValue instance', () => {
|
|
7
|
+
const rangeValue = new DyFM_RangeValue<number>(1, 10);
|
|
8
|
+
spyOn(rangeValue, 'toString').and.returnValue('1-10');
|
|
9
|
+
expect(DyFM_slider_pipeTransform(rangeValue)).toBe('1-10');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should return the string representation of a number', () => {
|
|
13
|
+
const numberValue = 42;
|
|
14
|
+
expect(DyFM_slider_pipeTransform(numberValue)).toBe('42');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return the string as is if the input is a string', () => {
|
|
18
|
+
const stringValue = 'test';
|
|
19
|
+
expect(DyFM_slider_pipeTransform(stringValue)).toBe('test');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_smartReplace_pipeTransform } from './pip-smart-replace-pipe.util';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_smartReplace_pipeTransform', () => {
|
|
5
|
+
it('should return the original value if replacer is not defined', () => {
|
|
6
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {name}!', null);
|
|
7
|
+
expect(result).toBe('Hello, {name}!');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should replace keys with values from replacer', () => {
|
|
11
|
+
const replacer = { name: { value: 'World', pipes: [] } };
|
|
12
|
+
spyOn(console, 'warn');
|
|
13
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {name}!', replacer);
|
|
14
|
+
expect(result).toBe('Hello, World!');
|
|
15
|
+
expect(console.warn).not.toHaveBeenCalled();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should warn if replacer key has no pipes', () => {
|
|
19
|
+
const replacer = { name: { value: 'World' } };
|
|
20
|
+
spyOn(console, 'warn');
|
|
21
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {name}!', replacer);
|
|
22
|
+
expect(result).toBeUndefined();
|
|
23
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
24
|
+
'DYNAMO WARNING: ' +
|
|
25
|
+
'\nSmartReplacePipe: replaceTo[name].multiPipe is not defined...',
|
|
26
|
+
'\n\n',
|
|
27
|
+
jasmine.any(Error)
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should warn if replacer key pipes is not an array', () => {
|
|
32
|
+
const replacer = { name: { value: 'World', pipes: 'not-an-array' } };
|
|
33
|
+
spyOn(console, 'warn');
|
|
34
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {name}!', replacer);
|
|
35
|
+
expect(result).toBeUndefined();
|
|
36
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
37
|
+
'DYNAMO WARNING: ' +
|
|
38
|
+
'\nSmartReplacePipe: replaceTo[name].multiPipe is not an array...',
|
|
39
|
+
'\n\n',
|
|
40
|
+
jasmine.any(Error)
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/* it('should apply multiPipes if provided', () => {
|
|
45
|
+
const replacer = { name: 'World' };
|
|
46
|
+
const multiPipes: DyFM_MultiPipe_Setting[] = [];
|
|
47
|
+
spyOn(DyFM_multiPipe_pipeTransform).and.callThrough();
|
|
48
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {name}!', replacer, multiPipes);
|
|
49
|
+
expect(result).toBe('Hello, World!');
|
|
50
|
+
expect(DyFM_multiPipe_pipeTransform).toHaveBeenCalledWith('World', multiPipes);
|
|
51
|
+
}); */
|
|
52
|
+
|
|
53
|
+
it('should handle multiple replacements', () => {
|
|
54
|
+
const replacer = {
|
|
55
|
+
firstName: { value: 'John', pipes: [] },
|
|
56
|
+
lastName: { value: 'Doe', pipes: [] }
|
|
57
|
+
};
|
|
58
|
+
const result = DyFM_smartReplace_pipeTransform('Hello, {firstName} {lastName}!', replacer);
|
|
59
|
+
expect(result).toBe('Hello, John Doe!');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
import { second } from '../../../_collections/constants/times.const';
|
|
3
|
+
import { DyFM_SocketClient_Params } from './sck-client-params.control-model';
|
|
4
|
+
|
|
5
|
+
describe('DyFM_SocketClient_Params', () => {
|
|
6
|
+
xit('should assign provided values to the instance', () => {
|
|
7
|
+
const params: DyFM_SocketClient_Params = {
|
|
8
|
+
name: 'testName',
|
|
9
|
+
service: 'testService',
|
|
10
|
+
address: '127.0.0.1',
|
|
11
|
+
port: 8080,
|
|
12
|
+
reconnectDelay: second * 5,
|
|
13
|
+
reconnect: false,
|
|
14
|
+
socketOptions: { autoConnect: false }
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const instance = new DyFM_SocketClient_Params(params);
|
|
18
|
+
|
|
19
|
+
expect(instance.name).toBe(params.name);
|
|
20
|
+
expect(instance.service).toBe(params.service);
|
|
21
|
+
expect(instance.address).toBe(params.address);
|
|
22
|
+
expect(instance.port).toBe(params.port);
|
|
23
|
+
expect(instance.reconnectDelay).toBe(params.reconnectDelay);
|
|
24
|
+
expect(instance.reconnect).toBe(params.reconnect);
|
|
25
|
+
expect(instance.socketOptions).toEqual(params.socketOptions);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should set default values for reconnectDelay and reconnect', () => {
|
|
29
|
+
const params: DyFM_SocketClient_Params = {};
|
|
30
|
+
|
|
31
|
+
const instance = new DyFM_SocketClient_Params(params);
|
|
32
|
+
|
|
33
|
+
expect(instance.reconnectDelay).toBe(second * 10);
|
|
34
|
+
expect(instance.reconnect).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should set reconnect to false if socketOptions.autoConnect is true', () => {
|
|
38
|
+
const params: DyFM_SocketClient_Params = {
|
|
39
|
+
socketOptions: { autoConnect: true }
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const instance = new DyFM_SocketClient_Params(params);
|
|
43
|
+
|
|
44
|
+
expect(instance.reconnect).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should set reconnect to false if socketOptions.reconnection is true', () => {
|
|
48
|
+
const params: DyFM_SocketClient_Params = {
|
|
49
|
+
socketOptions: { reconnection: true }
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const instance = new DyFM_SocketClient_Params(params);
|
|
53
|
+
|
|
54
|
+
expect(instance.reconnect).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should set reconnect to true if reconnectDelay is provided and socketOptions do not override', () => {
|
|
58
|
+
const params: DyFM_SocketClient_Params = {
|
|
59
|
+
reconnectDelay: second * 5,
|
|
60
|
+
socketOptions: { autoConnect: false, reconnection: false }
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const instance = new DyFM_SocketClient_Params(params);
|
|
64
|
+
|
|
65
|
+
expect(instance.reconnect).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_global_settings } from '../../../_collections/constants/global-settings.const';
|
|
3
|
+
import { DyFM_Log } from '../../../_collections/utils/log.util';
|
|
4
|
+
import { DyFM_SocketEvent_Key } from '../_enums/sck-event-key.enum';
|
|
5
|
+
import { DyFM_SocketEvent, DyFM_SocketEventPreprocessTask, DyFM_SocketEventTask } from './sck-socket-event.control-model';
|
|
6
|
+
|
|
7
|
+
describe('DyFM_SocketEvent', () => {
|
|
8
|
+
let socketEvent: DyFM_SocketEvent<any>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
socketEvent = new DyFM_SocketEvent({
|
|
12
|
+
eventKey: DyFM_SocketEvent_Key.connect,
|
|
13
|
+
preProcesses: [],
|
|
14
|
+
tasks: [],
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should initialize with default values', () => {
|
|
19
|
+
expect(socketEvent.name).toBe(DyFM_SocketEvent_Key.connect);
|
|
20
|
+
expect(socketEvent.serviceName).toBe('UnknownSocketService');
|
|
21
|
+
expect(socketEvent.preProcesses).toEqual([]);
|
|
22
|
+
expect(socketEvent.tasks).toEqual([]);
|
|
23
|
+
expect(socketEvent.logEvent).toBe(DyFM_global_settings.log_settings.socket_mainEvents);
|
|
24
|
+
expect(socketEvent.logEventContent).toBe(DyFM_global_settings.log_settings.socket_eventContent);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should execute preProcesses and tasks', async () => {
|
|
28
|
+
const mockPreProcess: DyFM_SocketEventPreprocessTask<any, any> = jasmine.createSpy('preProcess').and.callFake(async (content) => content);
|
|
29
|
+
const mockTask: DyFM_SocketEventTask<any> = jasmine.createSpy('task').and.callFake(async () => {});
|
|
30
|
+
|
|
31
|
+
socketEvent.preProcesses = [mockPreProcess];
|
|
32
|
+
socketEvent.tasks = [mockTask];
|
|
33
|
+
|
|
34
|
+
await socketEvent.executeEventTasks('testContent', 'testIssuer');
|
|
35
|
+
|
|
36
|
+
expect(mockPreProcess).toHaveBeenCalledWith('testContent');
|
|
37
|
+
expect(mockTask).toHaveBeenCalledWith('testContent', 'testIssuer');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should log event if logEvent is true', async () => {
|
|
41
|
+
spyOn(DyFM_Log, 'log');
|
|
42
|
+
socketEvent.logEvent = true;
|
|
43
|
+
|
|
44
|
+
await socketEvent.executeEventTasks('testContent', 'testIssuer');
|
|
45
|
+
|
|
46
|
+
expect(DyFM_Log.log).toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should handle errors in executeEventTasks gracefully', async () => {
|
|
50
|
+
const mockTask: DyFM_SocketEventTask<any> = jasmine.createSpy('task').and.callFake(async () => {
|
|
51
|
+
throw new Error('Task Error');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
socketEvent.tasks = [mockTask];
|
|
55
|
+
spyOn(DyFM_Log, 'error');
|
|
56
|
+
|
|
57
|
+
await socketEvent.executeEventTasks('testContent', 'testIssuer');
|
|
58
|
+
|
|
59
|
+
expect(DyFM_Log.error).toHaveBeenCalledWith(
|
|
60
|
+
`Socket Event tasks failed to execute on UnknownSocketService.... (${DyFM_SocketEvent_Key.connect})`,
|
|
61
|
+
jasmine.any(Error),
|
|
62
|
+
'content:',
|
|
63
|
+
'testContent'
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -13,7 +13,7 @@ export type DyFM_SocketEventTask<T> = (content?: T, issuer?: string) => Promise<
|
|
|
13
13
|
* socket handling and clarification is under development
|
|
14
14
|
*/
|
|
15
15
|
export class DyFM_SocketEvent<T>{
|
|
16
|
-
|
|
16
|
+
name?: string;
|
|
17
17
|
eventKey: DyFM_SocketEvent_Key | string;
|
|
18
18
|
serviceName?: string;
|
|
19
19
|
|
|
@@ -61,7 +61,7 @@ export class DyFM_SocketEvent<T>{
|
|
|
61
61
|
}
|
|
62
62
|
) {
|
|
63
63
|
try {
|
|
64
|
-
this.
|
|
64
|
+
this.name = set.name ?? set.eventKey;
|
|
65
65
|
this.eventKey = set.eventKey;
|
|
66
66
|
this.serviceName = set.serviceName ?? 'UnknownSocketService';
|
|
67
67
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_Log } from '../../../_collections/utils/log.util';
|
|
3
|
+
import { DyFM_SocketEvent_Key } from '../_enums/sck-event-key.enum';
|
|
4
|
+
import { DyFM_SocketClient_Params } from '../_models/sck-client-params.control-model';
|
|
5
|
+
import { DyFM_SocketEvent } from '../_models/sck-socket-event.control-model';
|
|
6
|
+
import { DyFM_SocketClient_ServiceBase } from './sck-client.service-base';
|
|
7
|
+
|
|
8
|
+
class TestSocketClientService extends DyFM_SocketClient_ServiceBase {
|
|
9
|
+
getParams(): DyFM_SocketClient_Params {
|
|
10
|
+
return {
|
|
11
|
+
name: 'testService',
|
|
12
|
+
address: 'http://localhost',
|
|
13
|
+
port: 3000,
|
|
14
|
+
reconnect: true,
|
|
15
|
+
reconnectDelay: 1000,
|
|
16
|
+
socketOptions: {},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getIncomingEvents(): DyFM_SocketEvent<any>[] {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async getSubscriptionContent(): Promise<any> {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
xdescribe('DyFM_SocketClient_ServiceBase', () => {
|
|
30
|
+
let service: TestSocketClientService;
|
|
31
|
+
|
|
32
|
+
/* beforeEach(() => {
|
|
33
|
+
TestBed.configureTestingModule({});
|
|
34
|
+
service = new TestSocketClientService();
|
|
35
|
+
}); */
|
|
36
|
+
|
|
37
|
+
it('should initialize with default values', () => {
|
|
38
|
+
expect(service.connected).toBeFalse();
|
|
39
|
+
expect(service.subscribed).toBeFalse();
|
|
40
|
+
expect(service.subscriptionInProgress).toBeFalse();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should connect and disconnect socket', async () => {
|
|
44
|
+
spyOn(DyFM_Log, 'success');
|
|
45
|
+
spyOn(DyFM_Log, 'warn');
|
|
46
|
+
|
|
47
|
+
await service['setupDefaultEvents']();
|
|
48
|
+
await service['setupSocketEvents']();
|
|
49
|
+
|
|
50
|
+
service['socket'].emit(DyFM_SocketEvent_Key.connect);
|
|
51
|
+
expect(service.connected).toBeTrue();
|
|
52
|
+
expect(DyFM_Log.success).toHaveBeenCalledWith('< > socket-client(testService) connected!');
|
|
53
|
+
|
|
54
|
+
service['socket'].emit(DyFM_SocketEvent_Key.disconnect);
|
|
55
|
+
expect(service.connected).toBeFalse();
|
|
56
|
+
expect(DyFM_Log.warn).toHaveBeenCalledWith('<x > socket-client(testService) disconnected!');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should handle subscription and unsubscription', async () => {
|
|
60
|
+
spyOn(DyFM_Log, 'success');
|
|
61
|
+
spyOn(DyFM_Log, 'warn');
|
|
62
|
+
|
|
63
|
+
await service.subscribe();
|
|
64
|
+
expect(service.subscriptionInProgress).toBeFalse();
|
|
65
|
+
expect(DyFM_Log.success).toHaveBeenCalledWith('<=--> socket-client(testService) subscription successful!');
|
|
66
|
+
|
|
67
|
+
await service.unsubscribe();
|
|
68
|
+
expect(DyFM_Log.success).toHaveBeenCalledWith('<x--> socket-client(testService) unsubscribe successful!');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should handle errors during subscription', async () => {
|
|
72
|
+
spyOn(DyFM_Log, 'error');
|
|
73
|
+
spyOn(service, 'getSubscriptionContent').and.throwError('Subscription error');
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
await service.subscribe();
|
|
77
|
+
} catch (error) {
|
|
78
|
+
expect(DyFM_Log.error).toHaveBeenCalledWith('socket-client(testService) Service Subscribe failed!', jasmine.any(Error));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should emit events correctly', async () => {
|
|
83
|
+
spyOn(DyFM_Log, 'log');
|
|
84
|
+
spyOn(service['socket'], 'emit');
|
|
85
|
+
|
|
86
|
+
await service['emitEvent'](DyFM_SocketEvent_Key.subscribe, { data: 'test' });
|
|
87
|
+
expect(DyFM_Log.log).toHaveBeenCalledWith('<=-- outgoing socket-client(testService) event: subscribe');
|
|
88
|
+
expect(service['socket'].emit).toHaveBeenCalledWith(DyFM_SocketEvent_Key.subscribe, { data: 'test' });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/* it('should reconnect if needed', async () => {
|
|
92
|
+
spyOn(service, 'connectSocket');
|
|
93
|
+
spyOn(DyFM_delay, 'delay').and.returnValue(Promise.resolve());
|
|
94
|
+
|
|
95
|
+
service['connected'] = false;
|
|
96
|
+
await service['tryReconnectIfNeeded']();
|
|
97
|
+
expect(service.connectSocket).toHaveBeenCalled();
|
|
98
|
+
}); */
|
|
99
|
+
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
import * as SocketIOClient from 'socket.io-client';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
DyFM_global_settings
|
|
4
|
+
import {
|
|
5
|
+
DyFM_global_settings
|
|
6
6
|
} from '../../../_collections/constants/global-settings.const';
|
|
7
|
-
import { DyFM_Error } from '../../../_models/control-models/error.control-model';
|
|
8
|
-
import { DyFM_Log } from '../../../_collections/utils/log.util';
|
|
9
7
|
import { DyFM_Array } from '../../../_collections/utils/array.util';
|
|
8
|
+
import { DyFM_Log } from '../../../_collections/utils/log.util';
|
|
10
9
|
import { DyFM_delay } from '../../../_collections/utils/utilities.util';
|
|
10
|
+
import { DyFM_Error } from '../../../_models/control-models/error.control-model';
|
|
11
11
|
|
|
12
|
+
import { BehaviorSubject } from 'rxjs';
|
|
12
13
|
import { DyFM_SocketEvent_Key } from '../_enums/sck-event-key.enum';
|
|
13
14
|
import { DyFM_SocketClient_Params } from '../_models/sck-client-params.control-model';
|
|
14
15
|
import { DyFM_SocketEvent } from '../_models/sck-socket-event.control-model';
|
|
15
|
-
import { BehaviorSubject } from 'rxjs';
|
|
16
16
|
|
|
17
17
|
export abstract class DyFM_SocketClient_ServiceBase<T_SubscriptionContent = any> {
|
|
18
18
|
|
|
@@ -28,14 +28,14 @@ export abstract class DyFM_SocketClient_ServiceBase<T_SubscriptionContent = any>
|
|
|
28
28
|
get connected(): boolean { return this._connected_BS.value; }
|
|
29
29
|
readonly connected$ = this._connected_BS.asObservable();
|
|
30
30
|
|
|
31
|
-
private _subscribed_BS: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
31
|
+
private readonly _subscribed_BS: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
32
32
|
get subscribed(): boolean { return this._subscribed_BS.value; }
|
|
33
33
|
readonly subscribed$ = this._subscribed_BS.asObservable();
|
|
34
34
|
|
|
35
35
|
protected debugLog: boolean = DyFM_global_settings.log_settings.setup;
|
|
36
36
|
protected logFn: boolean = DyFM_global_settings.log_settings.functions;
|
|
37
37
|
|
|
38
|
-
private defaultEvents: DyFM_SocketEvent<any>[] = [
|
|
38
|
+
private readonly defaultEvents: DyFM_SocketEvent<any>[] = [
|
|
39
39
|
new DyFM_SocketEvent<any>({
|
|
40
40
|
eventKey: DyFM_SocketEvent_Key.connect,
|
|
41
41
|
tasks: [
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_UsageAction } from './usg-action.control-model';
|
|
3
|
+
|
|
4
|
+
describe('DyFM_UsageAction', () => {
|
|
5
|
+
|
|
6
|
+
it('should create an instance with default values', () => {
|
|
7
|
+
const action = new DyFM_UsageAction();
|
|
8
|
+
expect(action.action).toBeUndefined();
|
|
9
|
+
expect(action.time).toBeUndefined();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should create an instance with provided values', () => {
|
|
13
|
+
const date = new Date();
|
|
14
|
+
const action = new DyFM_UsageAction({ action: 'testAction', time: date });
|
|
15
|
+
expect(action.action).toBe('testAction');
|
|
16
|
+
expect(action.time).toBe(date);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should assign properties from another DyFM_UsageAction instance', () => {
|
|
20
|
+
const date = new Date();
|
|
21
|
+
const sourceAction = new DyFM_UsageAction({ action: 'sourceAction', time: date });
|
|
22
|
+
const newAction = new DyFM_UsageAction(sourceAction);
|
|
23
|
+
expect(newAction.action).toBe('sourceAction');
|
|
24
|
+
expect(newAction.time).toBe(date);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { DyFM_DailyUsageData } from './usg-daily-usage-data.control-model';
|
|
3
|
+
import { DyFM_UsageSession } from './usg-session.data-model';
|
|
4
|
+
|
|
5
|
+
describe('DyFM_DailyUsageData', () => {
|
|
6
|
+
it('should create an instance with default values', () => {
|
|
7
|
+
const instance = new DyFM_DailyUsageData();
|
|
8
|
+
expect(instance.date).toBeUndefined();
|
|
9
|
+
expect(instance.totalVisitTime).toBe(0);
|
|
10
|
+
expect(instance.averageVisitTime).toBe(0);
|
|
11
|
+
expect(instance.visitorsHun).toBe(0);
|
|
12
|
+
expect(instance.visitorsElse).toBe(0);
|
|
13
|
+
expect(instance.visitations).toEqual([]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should create an instance with provided values', () => {
|
|
17
|
+
const usageSession: DyFM_UsageSession = { /* mock session data */ };
|
|
18
|
+
const data: DyFM_DailyUsageData = {
|
|
19
|
+
date: '2023-10-01',
|
|
20
|
+
totalVisitTime: 120,
|
|
21
|
+
averageVisitTime: 30,
|
|
22
|
+
visitorsHun: 10,
|
|
23
|
+
visitorsElse: 5,
|
|
24
|
+
visitations: [usageSession]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const instance = new DyFM_DailyUsageData(data);
|
|
28
|
+
|
|
29
|
+
expect(instance.date).toBe('2023-10-01');
|
|
30
|
+
expect(instance.totalVisitTime).toBe(120);
|
|
31
|
+
expect(instance.averageVisitTime).toBe(30);
|
|
32
|
+
expect(instance.visitorsHun).toBe(10);
|
|
33
|
+
expect(instance.visitorsElse).toBe(5);
|
|
34
|
+
expect(instance.visitations).toEqual([usageSession]);
|
|
35
|
+
});
|
|
36
|
+
});
|