orc-shared 1.5.0-dev.9 → 1.5.1-dev.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/dist/actions/navigation.js +16 -1
- package/dist/actions/requestsApi.js +1 -0
- package/dist/actions/tasks.js +190 -0
- package/dist/buildStore.js +3 -1
- package/dist/components/AppFrame/Sidebar.js +4 -8
- package/dist/components/CategoryList.js +6 -0
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -0
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +13 -5
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +4 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +43 -46
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -2
- package/dist/components/Navigation/index.js +0 -1
- package/dist/components/Routing/Page.js +4 -1
- package/dist/components/Routing/SegmentPage.js +4 -1
- package/dist/components/Routing/SubPage.js +5 -6
- package/dist/components/Routing/withWaypointing.js +1 -1
- package/dist/components/TaskDetailsModal.js +193 -0
- package/dist/constants.js +16 -1
- package/dist/reducers/navigation.js +16 -0
- package/dist/reducers/request.js +4 -0
- package/dist/reducers/tasks.js +99 -0
- package/dist/selectors/authentication.js +17 -1
- package/dist/selectors/tasks.js +66 -0
- package/dist/sharedMessages.js +17 -1
- package/dist/utils/propertyHelper.js +35 -0
- package/dist/whyDidYouRerender.js +1 -0
- package/package.json +5 -5
- package/src/actions/navigation.js +7 -0
- package/src/actions/navigation.test.js +12 -0
- package/src/actions/tasks.js +77 -0
- package/src/actions/tasks.test.js +169 -0
- package/src/buildStore.js +2 -0
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +4 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +15 -3
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +39 -27
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +39 -34
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +2 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +52 -0
- package/src/components/Routing/Page.js +12 -1
- package/src/components/Routing/SegmentPage.js +12 -1
- package/src/components/Routing/SubPage.js +4 -7
- package/src/components/Routing/SubPage.test.js +46 -0
- package/src/components/TaskDetailsModal.js +132 -0
- package/src/components/TaskDetailsModal.test.js +317 -0
- package/src/components/Text.test.js +44 -59
- package/src/constants.js +13 -0
- package/src/hooks/useLabelMessage.test.js +16 -10
- package/src/reducers/navigation.js +24 -0
- package/src/reducers/navigation.test.js +38 -0
- package/src/reducers/request.js +4 -0
- package/src/reducers/request.test.js +11 -0
- package/src/reducers/tasks.js +56 -0
- package/src/reducers/tasks.test.js +404 -0
- package/src/selectors/authentication.js +13 -0
- package/src/selectors/authentication.test.js +322 -0
- package/src/selectors/tasks.js +16 -0
- package/src/selectors/tasks.test.js +60 -0
- package/src/sharedMessages.js +17 -1
- package/src/translations/en-US.json +16 -12
- package/src/translations/fr-CA.json +16 -12
- package/src/utils/propertyHelper.js +38 -0
- package/src/utils/propertyHelper.test.js +160 -0
- package/src/utils/timezoneHelper.test.js +4 -2
|
@@ -281,3 +281,163 @@ describe("isObjectContainsPropertyWithAnyValue", () => {
|
|
|
281
281
|
expect(result, "to be true");
|
|
282
282
|
});
|
|
283
283
|
});
|
|
284
|
+
|
|
285
|
+
describe("compareObjectProperty", () => {
|
|
286
|
+
it("Return 0 if both obj are null", () => {
|
|
287
|
+
const result = propertyHelper.compareObjectProperty(null, null, "prop");
|
|
288
|
+
|
|
289
|
+
expect(result, "to equal", 0);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it("Return 0 if obj1 is null and obj2 does not have property", () => {
|
|
293
|
+
const result = propertyHelper.compareObjectProperty(null, {}, "prop");
|
|
294
|
+
|
|
295
|
+
expect(result, "to equal", 0);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it("Return 0 if obj1 does not have property and obj1 is null", () => {
|
|
299
|
+
const result = propertyHelper.compareObjectProperty({}, null, "prop");
|
|
300
|
+
|
|
301
|
+
expect(result, "to equal", 0);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("Return 0 if both obj does not have property", () => {
|
|
305
|
+
const result = propertyHelper.compareObjectProperty({}, null, "prop");
|
|
306
|
+
|
|
307
|
+
expect(result, "to equal", 0);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it("Return 0 if both obj have property with null value", () => {
|
|
311
|
+
const result = propertyHelper.compareObjectProperty({ prop: null }, { prop: null }, "prop");
|
|
312
|
+
|
|
313
|
+
expect(result, "to equal", 0);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it("Return 0 if propertyName is null", () => {
|
|
317
|
+
const result = propertyHelper.compareObjectProperty({}, {}, null);
|
|
318
|
+
|
|
319
|
+
expect(result, "to equal", 0);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("Return 0 if propertyName is empty", () => {
|
|
323
|
+
const result = propertyHelper.compareObjectProperty({}, {}, "");
|
|
324
|
+
|
|
325
|
+
expect(result, "to equal", 0);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it("Return 0 if property has same value (string)", () => {
|
|
329
|
+
const result = propertyHelper.compareObjectProperty({ prop: "a" }, { prop: "a" }, "prop");
|
|
330
|
+
|
|
331
|
+
expect(result, "to equal", 0);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it("Return -1 if obj1 property is small than obj2 property (string)", () => {
|
|
335
|
+
const result = propertyHelper.compareObjectProperty({ prop: "a" }, { prop: "b" }, "prop");
|
|
336
|
+
|
|
337
|
+
expect(result, "to equal", -1);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it("Return 1 if obj1 property is bigger than obj2 property (string)", () => {
|
|
341
|
+
const result = propertyHelper.compareObjectProperty({ prop: "b" }, { prop: "a" }, "prop");
|
|
342
|
+
|
|
343
|
+
expect(result, "to equal", 1);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it("Return 0 if property has same value (numeric)", () => {
|
|
347
|
+
const result = propertyHelper.compareObjectProperty({ prop: 1 }, { prop: 1 }, "prop");
|
|
348
|
+
|
|
349
|
+
expect(result, "to equal", 0);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("Return -1 if obj1 property is small than obj2 property (numeric)", () => {
|
|
353
|
+
const result = propertyHelper.compareObjectProperty({ prop: 1 }, { prop: 2 }, "prop");
|
|
354
|
+
|
|
355
|
+
expect(result, "to equal", -1);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it("Return 1 if obj1 property is bigger than obj2 property (numeric)", () => {
|
|
359
|
+
const result = propertyHelper.compareObjectProperty({ prop: 2 }, { prop: 1 }, "prop");
|
|
360
|
+
|
|
361
|
+
expect(result, "to equal", 1);
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
describe("compareObjectPropertyDescending", () => {
|
|
366
|
+
it("Return 0 if both obj are null", () => {
|
|
367
|
+
const result = propertyHelper.compareObjectPropertyDescending(null, null, "prop");
|
|
368
|
+
|
|
369
|
+
expect(result, "to equal", 0);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it("Return 0 if obj1 is null and obj2 does not have property", () => {
|
|
373
|
+
const result = propertyHelper.compareObjectPropertyDescending(null, {}, "prop");
|
|
374
|
+
|
|
375
|
+
expect(result, "to equal", 0);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it("Return 0 if obj1 does not have property and obj1 is null", () => {
|
|
379
|
+
const result = propertyHelper.compareObjectPropertyDescending({}, null, "prop");
|
|
380
|
+
|
|
381
|
+
expect(result, "to equal", 0);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
it("Return 0 if both obj does not have property", () => {
|
|
385
|
+
const result = propertyHelper.compareObjectPropertyDescending({}, null, "prop");
|
|
386
|
+
|
|
387
|
+
expect(result, "to equal", 0);
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it("Return 0 if both obj have property with null value", () => {
|
|
391
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: null }, { prop: null }, "prop");
|
|
392
|
+
|
|
393
|
+
expect(result, "to equal", 0);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it("Return 0 if propertyName is null", () => {
|
|
397
|
+
const result = propertyHelper.compareObjectPropertyDescending({}, {}, null);
|
|
398
|
+
|
|
399
|
+
expect(result, "to equal", 0);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
it("Return 0 if propertyName is empty", () => {
|
|
403
|
+
const result = propertyHelper.compareObjectPropertyDescending({}, {}, "");
|
|
404
|
+
|
|
405
|
+
expect(result, "to equal", 0);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it("Return 0 if property has same value (string)", () => {
|
|
409
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: "a" }, { prop: "a" }, "prop");
|
|
410
|
+
|
|
411
|
+
expect(result, "to equal", 0);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it("Return -1 if obj1 property is small than obj2 property (string)", () => {
|
|
415
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: "a" }, { prop: "b" }, "prop");
|
|
416
|
+
|
|
417
|
+
expect(result, "to equal", 1);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
it("Return 1 if obj1 property is bigger than obj2 property (string)", () => {
|
|
421
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: "b" }, { prop: "a" }, "prop");
|
|
422
|
+
|
|
423
|
+
expect(result, "to equal", -1);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it("Return 0 if property has same value (numeric)", () => {
|
|
427
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: 1 }, { prop: 1 }, "prop");
|
|
428
|
+
|
|
429
|
+
expect(result, "to equal", 0);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it("Return -1 if obj1 property is small than obj2 property (numeric)", () => {
|
|
433
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: 1 }, { prop: 2 }, "prop");
|
|
434
|
+
|
|
435
|
+
expect(result, "to equal", 1);
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
it("Return 1 if obj1 property is bigger than obj2 property (numeric)", () => {
|
|
439
|
+
const result = propertyHelper.compareObjectPropertyDescending({ prop: 2 }, { prop: 1 }, "prop");
|
|
440
|
+
|
|
441
|
+
expect(result, "to equal", -1);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
@@ -40,14 +40,16 @@ describe("Timezone Helper", () => {
|
|
|
40
40
|
it("Retrieves user local timezone date", () => {
|
|
41
41
|
const timezoneName = "America/New_York";
|
|
42
42
|
const date = "Mon Apr 04 2022 13:00:00.000Z";
|
|
43
|
-
|
|
43
|
+
let expectedDate = new Date("2022-04-04T09:00:00.000Z");
|
|
44
|
+
expectedDate = new Date(expectedDate.getTime() + expectedDate.getTimezoneOffset() * 60000); // try to adapt expected date with current computer timezone
|
|
44
45
|
expect(convertTimeToLocalTimeZone, "called with", [date, timezoneName], "to satisfy", expectedDate);
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
it("Retrieves user other timezone date", () => {
|
|
48
49
|
const timezoneName = "America/New_York";
|
|
49
50
|
const date = "Mon Apr 04 2022 06:00:00.000Z";
|
|
50
|
-
|
|
51
|
+
let expectedDate = new Date("2022-04-04T10:00:00.000Z");
|
|
52
|
+
expectedDate = new Date(expectedDate.getTime() - expectedDate.getTimezoneOffset() * 60000); // try to adapt expected date with current computer timezone
|
|
51
53
|
expect(convertTimeToOtherTimeZone, "called with", [date, timezoneName], "to satisfy", expectedDate);
|
|
52
54
|
});
|
|
53
55
|
});
|