@masterportal/masterportalapi 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.eslintrc +2 -1
  2. package/CHANGELOG.md +19 -1
  3. package/example/config/portal.json +8 -1
  4. package/example/config/services.json +10 -0
  5. package/example/index.js +34 -2
  6. package/jest.config.js +1 -1
  7. package/jest.setup.js +9 -1
  8. package/package.json +63 -63
  9. package/src/layer/geojson/index.js +3 -3
  10. package/src/lib/attributeMapper.js +231 -0
  11. package/src/lib/getValueFromObjectByPath.js +73 -0
  12. package/src/lib/thousandsSeparator.js +23 -0
  13. package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +3 -0
  14. package/src/vectorStyle/createStyle.js +259 -0
  15. package/src/vectorStyle/lib/colorConvertions.js +97 -0
  16. package/src/vectorStyle/lib/createLegendInfo.js +28 -0
  17. package/src/vectorStyle/lib/getGeometryTypeFromService.js +153 -0
  18. package/src/vectorStyle/lib/getRuleForIndex.js +62 -0
  19. package/src/vectorStyle/lib/valueOperations.js +172 -0
  20. package/src/vectorStyle/styleList.js +281 -0
  21. package/src/vectorStyle/styles/defaultStyles.js +177 -0
  22. package/src/vectorStyle/styles/point/stylePoint.js +108 -0
  23. package/src/vectorStyle/styles/point/stylePointCircle.js +29 -0
  24. package/src/vectorStyle/styles/point/stylePointIcon.js +79 -0
  25. package/src/vectorStyle/styles/point/stylePointInterval.js +124 -0
  26. package/src/vectorStyle/styles/point/stylePointNominal.js +232 -0
  27. package/src/vectorStyle/styles/point/stylePointRegularShape.js +39 -0
  28. package/src/vectorStyle/styles/polygon/polygonStyleHatch.js +160 -0
  29. package/src/vectorStyle/styles/polygon/stylePolygon.js +125 -0
  30. package/src/vectorStyle/styles/style.js +161 -0
  31. package/src/vectorStyle/styles/styleCesium.js +106 -0
  32. package/src/vectorStyle/styles/styleLine.js +51 -0
  33. package/src/vectorStyle/styles/styleText.js +143 -0
  34. package/test/lib/attributeMapper.test.js +290 -0
  35. package/test/lib/getValueFromObjectByPath.test.js +61 -0
  36. package/test/lib/thousandsSeparator.test.js +58 -0
  37. package/test/vectorStyle/createStyle.test.js +335 -0
  38. package/test/vectorStyle/lib/colorConvertions.test.js +42 -0
  39. package/test/vectorStyle/lib/getRuleForIndex.test.js +132 -0
  40. package/test/vectorStyle/lib/valueOperations.test.js +191 -0
  41. package/test/vectorStyle/styles/point/stylePoint.test.js +28 -0
  42. package/test/vectorStyle/styles/point/stylePointCircle.test.js +30 -0
  43. package/test/vectorStyle/styles/point/stylePointIcon.test.js +83 -0
  44. package/test/vectorStyle/styles/point/stylePointInterval.test.js +57 -0
  45. package/test/vectorStyle/styles/point/stylePointNominal.test.js +84 -0
  46. package/test/vectorStyle/styles/point/stylePointRegularShape.test.js +24 -0
  47. package/test/vectorStyle/styles/polygon/polygonStyleHatch.test.js +95 -0
  48. package/test/vectorStyle/styles/polygon/stylePolygon.test.js +61 -0
  49. package/test/vectorStyle/styles/styleLine.test.js +29 -0
  50. package/test/vectorStyle/styles/styleText.test.js +49 -0
@@ -0,0 +1,143 @@
1
+ import StyleClass from "./style";
2
+ import {Text, Fill, Stroke} from "ol/style.js";
3
+ import {mapAttributes} from "../../lib/attributeMapper";
4
+ import {prepareValue, isObjectPath} from "../../lib/attributeMapper";
5
+ import defaultStyle from "./defaultStyles";
6
+
7
+ class TextStyle extends StyleClass {
8
+ /**
9
+ * @description Class to create ol.style/Text
10
+ * @class TextStyle
11
+ * @constructor
12
+ * @extends StyleClass
13
+ * @memberof VectorStyle.Style
14
+ */
15
+ constructor () {
16
+ super();
17
+ this.attributes = {...defaultStyle.text};
18
+ }
19
+
20
+ /**
21
+ * This function initializes the styleText Object by setting or overwriting some attributes.
22
+ * @param {ol/feature} feature Feature to be styled.
23
+ * @param {object} styles styling properties to overwrite defaults
24
+ * @param {Boolean} isClustered Flag to show if feature is clustered.
25
+ * @returns {void}
26
+ */
27
+ initialize (feature, styles, isClustered) {
28
+ this.setFeature(feature);
29
+ this.setIsClustered(isClustered);
30
+ this.overwriteStyling(styles);
31
+ this.setStyle(this.getStyle());
32
+ }
33
+
34
+ /**
35
+ * This function returns a style for each feature.
36
+ * @returns {ol/style} - The created style.
37
+ */
38
+ getStyle () {
39
+ const isClustered = this.isClustered,
40
+ feature = this.feature,
41
+ labelField = this.labelField;
42
+
43
+ if (isClustered && feature.get("features")?.length > 1 && this.attributes.clusterTextType !== "none") {
44
+ return this.createClusteredTextStyle();
45
+ }
46
+ else if (labelField) {
47
+ return this.createLabeledTextStyle();
48
+ }
49
+
50
+ return new Text();
51
+ }
52
+
53
+ /**
54
+ * Returns the rotation value and its corresponding value according to style.json.
55
+ * @param {Object} rotation - The rotation object from the style.json
56
+ * @param {Object} featureValues - The values object from the feature
57
+ * @returns {number} - The rotation value in degrees or radiants.
58
+ */
59
+ getRotationValue (rotation, featureValues) {
60
+ if (typeof rotation === "object") {
61
+ const {value, isDegree} = rotation;
62
+
63
+ if (isObjectPath(value) && featureValues !== undefined) {
64
+ const rotationValueFromService = parseInt(prepareValue(featureValues, value), 10);
65
+
66
+ return isDegree ? rotationValueFromService * Math.PI / 180 : rotationValueFromService;
67
+ }
68
+ return isDegree ? parseInt(value, 10) * Math.PI / 180 : parseInt(value, 10);
69
+ }
70
+ return 0;
71
+ }
72
+
73
+ /**
74
+ * Creates text style for clustered features. The text attribute is set according to "clusterTextType".
75
+ * "clusterTextType" === "counter" sets the number of clustered features.
76
+ * "clusterTextType" === "text" sets the value of "clusterText" or "undefined".
77
+ * @returns {ol/style/Text} - The created style.
78
+ */
79
+ createClusteredTextStyle () {
80
+ const feature = this.feature;
81
+ let text;
82
+
83
+ if (this.attributes.clusterTextType === "counter") {
84
+ text = feature.get("features").length.toString();
85
+ }
86
+ else if (this.attributes.clusterTextType === "text" && typeof this.attributes.clusterText === "string") {
87
+ text = this.attributes.clusterText;
88
+ }
89
+ else {
90
+ text = "undefined";
91
+ }
92
+
93
+ return new Text({
94
+ text: text,
95
+ textAlign: this.attributes.clusterTextAlign,
96
+ offsetX: this.attributes.clusterTextOffsetX,
97
+ offsetY: this.attributes.clusterTextOffsetY,
98
+ font: this.attributes.clusterTextFont,
99
+ scale: this.attributes.clusterTextScale,
100
+ fill: new Fill({
101
+ color: this.attributes.clusterTextFillColor
102
+ }),
103
+ stroke: new Stroke({
104
+ color: this.attributes.clusterTextStrokeColor,
105
+ width: this.attributes.clusterTextStrokeWidth
106
+ }),
107
+ rotation: this.getRotationValue(this.attributes.rotation, feature.getProperties())
108
+ });
109
+ }
110
+
111
+ /**
112
+ * Creates text style for simple features. The text attribute is set using "labelField".
113
+ * @returns {ol/style/Text} - The created style.
114
+ */
115
+ createLabeledTextStyle () {
116
+ const feature = this.feature,
117
+ featureProperties = feature.getProperties(),
118
+ textSuffix = this.attributes.textSuffix;
119
+ let text = mapAttributes(featureProperties, this.attributes.labelField, false);
120
+
121
+ if (textSuffix !== "") {
122
+ text = text + " " + textSuffix;
123
+ }
124
+ return new Text({
125
+ text: text.toString(),
126
+ textAlign: this.attributes.textAlign,
127
+ offsetX: this.attributes.textOffsetX,
128
+ offsetY: this.attributes.textOffsetY,
129
+ font: this.attributes.textFont,
130
+ scale: this.attributes.textScale,
131
+ fill: new Fill({
132
+ color: this.attributes.textFillColor
133
+ }),
134
+ stroke: new Stroke({
135
+ color: this.attributes.textStrokeColor,
136
+ width: this.attributes.textStrokeWidth
137
+ }),
138
+ rotation: this.getRotationValue(this.attributes.rotation, featureProperties)
139
+ });
140
+ }
141
+ }
142
+
143
+ export default TextStyle;
@@ -0,0 +1,290 @@
1
+ import {mapAttributes, isObjectPath} from "../../src/lib/attributeMapper";
2
+
3
+ const props = {
4
+ random_text: "foobar",
5
+ random_boolean: true,
6
+ random_int: 12345,
7
+ random_float: 1.23,
8
+ random_date: "2021-11-17 13:02:00 UTC",
9
+ random_datastreams: [
10
+ {
11
+ Observations: [
12
+ {
13
+ result: 123
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ Observations: [
19
+ {
20
+ result: 456
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ };
26
+
27
+ describe("src/utils/attributeMapper.js", () => {
28
+ describe("mapAttributes", () => {
29
+ it("should map object with single attribute", () => {
30
+ const mappingObj = {
31
+ random_text: "text"
32
+ };
33
+
34
+ expect(mapAttributes(props, mappingObj)).toEqual({
35
+ text: "foobar"
36
+ });
37
+ });
38
+ it("should map object with single attribute and objectpath", () => {
39
+ const mappingObj = {
40
+ "@random_text": "text"
41
+ };
42
+
43
+ expect(mapAttributes(props, mappingObj)).toEqual({
44
+ text: "foobar"
45
+ });
46
+ });
47
+ it("should map object with single attribute and nested objectpath", () => {
48
+ const mappingObj = {
49
+ "@random_datastreams.0.Observations.0.result": "result"
50
+ };
51
+
52
+ expect(mapAttributes(props, mappingObj)).toEqual({
53
+ result: 123
54
+ });
55
+ });
56
+ it("should map object with multiple attributes", () => {
57
+ const mappingObj = {
58
+ random_text: "text",
59
+ random_boolean: "boolean"
60
+ };
61
+
62
+ expect(mapAttributes(props, mappingObj)).toEqual({
63
+ text: "foobar",
64
+ boolean: true
65
+ });
66
+ });
67
+ it("should map object with multiple attributes with nested objectpath", () => {
68
+ const mappingObj = {
69
+ random_text: "text",
70
+ random_boolean: "boolean",
71
+ "@random_datastreams.0.Observations.0.result": "result"
72
+ };
73
+
74
+ expect(mapAttributes(props, mappingObj)).toEqual({
75
+ text: "foobar",
76
+ boolean: true,
77
+ result: 123
78
+ });
79
+ });
80
+ it("should map object with mapping object and condition:endsWith", () => {
81
+ const mappingObj = {
82
+ random_text: {
83
+ name: "text",
84
+ condition: "endsWith"
85
+ }
86
+ };
87
+
88
+ expect(mapAttributes(props, mappingObj)).toEqual({
89
+ text: "foobar"
90
+ });
91
+ });
92
+ it("should map object with mapping object and condition:startsWith", () => {
93
+ const mappingObj = {
94
+ random_text: {
95
+ name: "text",
96
+ condition: "startsWith"
97
+ }
98
+ };
99
+
100
+ expect(mapAttributes(props, mappingObj)).toEqual({
101
+ text: "foobar"
102
+ });
103
+ });
104
+ it("should map object with mapping object and condition:contains", () => {
105
+ const mappingObj = {
106
+ random_text: {
107
+ name: "text",
108
+ condition: "contains"
109
+ }
110
+ };
111
+
112
+ expect(mapAttributes(props, mappingObj)).toEqual({
113
+ text: "foobar"
114
+ });
115
+ });
116
+ it("should map object with mapping object and suffix", () => {
117
+ const mappingObj = {
118
+ random_text: {
119
+ name: "text",
120
+ condition: "contains",
121
+ suffix: "barfoo"
122
+ }
123
+ };
124
+
125
+ expect(mapAttributes(props, mappingObj)).toEqual({
126
+ text: "foobar barfoo"
127
+ });
128
+ });
129
+ it("should map object with mapping object and prefix", () => {
130
+ const mappingObj = {
131
+ random_text: {
132
+ name: "text",
133
+ condition: "contains",
134
+ prefix: "barfoo"
135
+ }
136
+ };
137
+
138
+ expect(mapAttributes(props, mappingObj)).toEqual({
139
+ text: "barfoofoobar"
140
+ });
141
+ });
142
+ it("should map object with mapping object and type:date", () => {
143
+ const mappingObj = {
144
+ random_date: {
145
+ name: "date",
146
+ condition: "contains",
147
+ type: "date"
148
+ }
149
+ };
150
+
151
+ expect(mapAttributes(props, mappingObj)).toEqual({
152
+ date: "2021-11-17T13:02:00.000+01:00"
153
+ });
154
+ });
155
+ it("should map object with mapping object and type:date and format:YYYY-MM-DD", () => {
156
+ const mappingObj = {
157
+ random_date: {
158
+ name: "date",
159
+ condition: "contains",
160
+ type: "date",
161
+ format: "YYYY-MM-DD"
162
+ }
163
+ };
164
+
165
+ expect(mapAttributes(props, mappingObj)).toEqual({
166
+ date: "2021-11-17"
167
+ });
168
+ });
169
+ it("should map object with mapping object and type:date and format:DD-MM-YYYYf", () => {
170
+ const mappingObj = {
171
+ random_date: {
172
+ name: "date",
173
+ condition: "contains",
174
+ type: "date",
175
+ format: "DD-MM-YYYY"
176
+ }
177
+ };
178
+
179
+ expect(mapAttributes(props, mappingObj)).toEqual({
180
+ date: "17-11-2021"
181
+ });
182
+ });
183
+ it("should map object with mapping object (random_int) and type:number", () => {
184
+ const mappingObj = {
185
+ random_int: {
186
+ name: "integer",
187
+ condition: "contains",
188
+ type: "number"
189
+ }
190
+ };
191
+
192
+ expect(mapAttributes(props, mappingObj)).toEqual({
193
+ integer: "12.345"
194
+ });
195
+ });
196
+ it("should map object with mapping object (random_float) and type:number", () => {
197
+ const mappingObj = {
198
+ random_float: {
199
+ name: "float",
200
+ condition: "contains",
201
+ type: "number"
202
+ }
203
+ };
204
+
205
+ expect(mapAttributes(props, mappingObj)).toEqual({
206
+ float: "1,23"
207
+ });
208
+ });
209
+ it("should map object with mapping object and type:boolean", () => {
210
+ const mappingObj = {
211
+ random_boolean: {
212
+ name: "boolean",
213
+ condition: "contains",
214
+ type: "boolean"
215
+ }
216
+ };
217
+
218
+ expect(mapAttributes(props, mappingObj)).toEqual({
219
+ boolean: "true"
220
+ });
221
+ });
222
+ it("should map object with mapping object and type:boolean and format", () => {
223
+ const mappingObj = {
224
+ random_boolean: {
225
+ name: "boolean",
226
+ condition: "contains",
227
+ type: "boolean",
228
+ format: {
229
+ true: "Ja",
230
+ false: "Nein"
231
+ }
232
+ }
233
+ };
234
+
235
+ expect(mapAttributes(props, mappingObj)).toEqual({
236
+ boolean: "Ja"
237
+ });
238
+ });
239
+ it("should map object with mapping object and type:boolean and format with i18next", () => {
240
+ const mappingObj = {
241
+ random_boolean: {
242
+ name: "boolean",
243
+ condition: "contains",
244
+ type: "boolean",
245
+ format: {
246
+ true: "common:modules.tools.gfi.boolean.yes",
247
+ false: "common:modules.tools.gfi.boolean.no"
248
+ }
249
+ }
250
+ };
251
+
252
+ // i18next only returns the path.
253
+ // Propably mocking of language-file would get the right translated value?
254
+ expect(mapAttributes(props, mappingObj)).toEqual({
255
+ boolean: "common:modules.tools.gfi.boolean.yes"
256
+ });
257
+ });
258
+ it("should map object with mapping object and no type (defaults to string)", () => {
259
+ const mappingObj = {
260
+ random_boolean: {
261
+ name: "boolean",
262
+ condition: "contains"
263
+ },
264
+ random_int: {
265
+ name: "int",
266
+ condition: "contains"
267
+ }
268
+ };
269
+
270
+ expect(mapAttributes(props, mappingObj)).toEqual({
271
+ boolean: "true",
272
+ int: "12345"
273
+ });
274
+ });
275
+ });
276
+ describe("isObjectPath", () => {
277
+ it("should return true for \"@foobar\"", () => {
278
+ expect(isObjectPath("@foobar")).toBe(true);
279
+ });
280
+ it("should return false for \"foobar\"", () => {
281
+ expect(isObjectPath("foobar")).toBe(false);
282
+ });
283
+ it("should return false for 1", () => {
284
+ expect(isObjectPath(1)).toBe(false);
285
+ });
286
+ it("should return false for true", () => {
287
+ expect(isObjectPath(true)).toBe(false);
288
+ });
289
+ });
290
+ });
@@ -0,0 +1,61 @@
1
+ import {getValueFromObjectByPath, getPathPartsFromPath} from "../../src/lib/getValueFromObjectByPath";
2
+
3
+ describe("src/utils/getValueFromObjectByPath.js", () => {
4
+ describe("getPathPartsFromPath", () => {
5
+ it("should walk through the given string, collecting all parts seperated by a dot", () => {
6
+ const path = "first.second.third",
7
+ expected = ["first", "second", "third"];
8
+
9
+ expect(getPathPartsFromPath(path)).toEqual(expected);
10
+ });
11
+ it("should ignore escaped dots on the way, removing escape signs", () => {
12
+ const path = "first.sec\\.ond.third",
13
+ expected = ["first", "sec.ond", "third"];
14
+
15
+ expect(getPathPartsFromPath(path)).toEqual(expected);
16
+ });
17
+ it("should be able to escape escape signs", () => {
18
+ const path = "first.sec\\\\ond.third",
19
+ expected = ["first", "sec\\ond", "third"];
20
+
21
+ expect(getPathPartsFromPath(path)).toEqual(expected);
22
+ });
23
+ });
24
+ describe("getValueFromObjectByPath", () => {
25
+ it("should return undefined if anything but an object or array is given as first param", () => {
26
+ expect(getValueFromObjectByPath(undefined, "")).toBe(undefined);
27
+ expect(getValueFromObjectByPath(null, "")).toBe(undefined);
28
+ expect(getValueFromObjectByPath("string", "")).toBe(undefined);
29
+ expect(getValueFromObjectByPath(1234, "")).toBe(undefined);
30
+ expect(getValueFromObjectByPath(true, "")).toBe(undefined);
31
+ expect(getValueFromObjectByPath(false, "")).toBe(undefined);
32
+ });
33
+ it("should return undefined if anything but a string is given as second param", () => {
34
+ expect(getValueFromObjectByPath({}, undefined)).toBe(undefined);
35
+ expect(getValueFromObjectByPath({}, null)).toBe(undefined);
36
+ expect(getValueFromObjectByPath({}, 1234)).toBe(undefined);
37
+ expect(getValueFromObjectByPath({}, true)).toBe(undefined);
38
+ expect(getValueFromObjectByPath({}, false)).toBe(undefined);
39
+ expect(getValueFromObjectByPath({}, {})).toBe(undefined);
40
+ expect(getValueFromObjectByPath({}, [])).toBe(undefined);
41
+ });
42
+ it("should return undefined if the given depthBarrier is reached during walkthrough", () => {
43
+ expect(getValueFromObjectByPath({test: {test: 1}}, "@test.test", "@", ".", 1)).toBe(undefined);
44
+ });
45
+ it("should return undefined if the given path can't be followed through the given object", () => {
46
+ expect(getValueFromObjectByPath({}, "@test")).toBe(undefined);
47
+ expect(getValueFromObjectByPath({test: null}, "@test.test")).toBe(undefined);
48
+ });
49
+ it("should return the found value if the given path was successfully followed through the object", () => {
50
+ expect(getValueFromObjectByPath({test: 1}, "@test")).toEqual(1);
51
+ expect(getValueFromObjectByPath({test: {test: 1}}, "@test")).toEqual({test: 1});
52
+ expect(getValueFromObjectByPath({test: {test: {test: 1}}}, "@test.test")).toEqual({test: 1});
53
+ });
54
+ it("should be able to handle a path without prefix when no prefix is given", () => {
55
+ expect(getValueFromObjectByPath({test: 1}, "test", false)).toEqual(1);
56
+ });
57
+ it("should be able to handle a path with a complex prefix", () => {
58
+ expect(getValueFromObjectByPath({test: 1}, "1234test", "1234")).toEqual(1);
59
+ });
60
+ });
61
+ });
@@ -0,0 +1,58 @@
1
+ import thousandsSeparator from "../../src/lib/thousandsSeparator";
2
+
3
+ describe("src/utils/thousandsSeparator.js", () => {
4
+ it("should return an empty string if the given param is not a number nor a string", () => {
5
+ expect(typeof thousandsSeparator(undefined)).toBe("string");
6
+ expect(thousandsSeparator(undefined)).toEqual("");
7
+ expect(typeof thousandsSeparator(null)).toBe("string");
8
+ expect(thousandsSeparator(null)).toEqual("");
9
+ expect(typeof thousandsSeparator([])).toBe("string");
10
+ expect(thousandsSeparator([])).toEqual("");
11
+ expect(typeof thousandsSeparator({})).toBe("string");
12
+ expect(thousandsSeparator({})).toEqual("");
13
+ expect(typeof thousandsSeparator(false)).toBe("string");
14
+ expect(thousandsSeparator(false)).toEqual("");
15
+ expect(typeof thousandsSeparator(true)).toBe("string");
16
+ expect(thousandsSeparator(true)).toEqual("");
17
+ });
18
+ it("should convert a number into a string", () => {
19
+ expect(typeof thousandsSeparator(1)).toBe("string");
20
+ });
21
+ it("should convert a negative number into a string", () => {
22
+ expect(typeof thousandsSeparator(-1)).toBe("string");
23
+ });
24
+ it("should return a string if a string was given", () => {
25
+ expect(typeof thousandsSeparator("1")).toBe("string");
26
+ });
27
+ it("should add the given letter(s) as thousands separator", () => {
28
+ expect(thousandsSeparator(1000, "delimAbs")).toEqual("1delimAbs000");
29
+ });
30
+ it("should add the given letter(s) as decimal point for positive value", () => {
31
+ expect(thousandsSeparator(1000.1, "delimAbs", "delimDec")).toEqual("1delimAbs000delimDec1");
32
+ });
33
+ it("should create a number in german format by default for positive value", () => {
34
+ expect(thousandsSeparator(1000.1)).toEqual("1.000,1");
35
+ });
36
+ it("should be able to add a higher number of thousands separators", () => {
37
+ expect(thousandsSeparator(1123456789.123456)).toEqual("1.123.456.789,123456");
38
+ });
39
+ it("should be able to add a higher number of thousands separators if a string was given", () => {
40
+ expect(thousandsSeparator("1123456789.123456")).toEqual("1.123.456.789,123456");
41
+ });
42
+ it("should add the given letter(s) as thousands seperator", () => {
43
+ expect(thousandsSeparator(-1000, "delimAbs")).toEqual("-1delimAbs000");
44
+ });
45
+ it("should add the given letter(s) as decimal point for negative value", () => {
46
+ expect(thousandsSeparator(-1000.1, "delimAbs", "delimDec")).toEqual("-1delimAbs000delimDec1");
47
+ });
48
+ it("should create a number in german format by default for negative value", () => {
49
+ expect(thousandsSeparator(-1000.1)).toEqual("-1.000,1");
50
+ });
51
+ it("should be able to add a higher number of thousands seperators", () => {
52
+ expect(thousandsSeparator(-1123456789.123456)).toEqual("-1.123.456.789,123456");
53
+ });
54
+ it("should be able to add a higher number of thousands seperators if a string was given", () => {
55
+ expect(thousandsSeparator("-1123456789.123456")).toEqual("-1.123.456.789,123456");
56
+ });
57
+ });
58
+