@fincity/kirun-js 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/engine/function/system/string/StringFunctionRepoTest4.ts +55 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/function/system/string/StringFunctionRepository.ts +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
2
|
+
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
3
|
+
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
4
|
+
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
5
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
6
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
7
|
+
|
|
8
|
+
const repo = new StringFunctionRepository();
|
|
9
|
+
|
|
10
|
+
test('StringFunctionRepository - Replace', async () => {
|
|
11
|
+
let fun = await repo.find(Namespaces.STRING, 'Replace');
|
|
12
|
+
|
|
13
|
+
if (!fun) {
|
|
14
|
+
throw new Error('Function not available');
|
|
15
|
+
}
|
|
16
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
17
|
+
new KIRunFunctionRepository(),
|
|
18
|
+
new KIRunSchemaRepository(),
|
|
19
|
+
);
|
|
20
|
+
fep.setArguments(
|
|
21
|
+
MapUtil.of(
|
|
22
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
23
|
+
' new elemenet ',
|
|
24
|
+
AbstractStringFunction.PARAMETER_SECOND_STRING_NAME,
|
|
25
|
+
' ',
|
|
26
|
+
AbstractStringFunction.PARAMETER_THIRD_STRING_NAME,
|
|
27
|
+
'',
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
expect(
|
|
32
|
+
(await fun.execute(fep))
|
|
33
|
+
.allResults()[0]
|
|
34
|
+
.getResult()
|
|
35
|
+
.get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
36
|
+
).toBe('newelemenet');
|
|
37
|
+
|
|
38
|
+
fep.setArguments(
|
|
39
|
+
MapUtil.of(
|
|
40
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
41
|
+
'thereisnospace',
|
|
42
|
+
AbstractStringFunction.PARAMETER_SECOND_STRING_NAME,
|
|
43
|
+
' ',
|
|
44
|
+
AbstractStringFunction.PARAMETER_THIRD_STRING_NAME,
|
|
45
|
+
' ',
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
expect(
|
|
50
|
+
(await fun.execute(fep))
|
|
51
|
+
.allResults()[0]
|
|
52
|
+
.getResult()
|
|
53
|
+
.get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
54
|
+
).toBe('thereisnospace');
|
|
55
|
+
});
|