box-ui-elements 20.0.0-beta.4 → 20.0.0-beta.6

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.
@@ -1307,7 +1307,7 @@ boxui.quickSearch.parentFolder = অভিভাবকের ফোল্ডা
1307
1307
  # Icon title for a Box item of type folder that is private and has no collaborators
1308
1308
  boxui.quickSearch.personalFolder = ব্যক্তিগত ফোল্ডার
1309
1309
  # Text for a quick search result describing the date when the user last updated the item
1310
- boxui.quickSearch.updatedText = {user}{date, date, medium} দ্বারা
1310
+ boxui.quickSearch.updatedText = {user}{date, date, medium} দ্বারা
1311
1311
  # Statement describing when and who last updated a quick search result item, capitalize if appropriate
1312
1312
  boxui.quickSearch.updatedTextToday = আজ {user}-এর মধ্যে
1313
1313
  # Statement describing when and who last updated a quick search result item, capitalize if appropriate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-ui-elements",
3
- "version": "20.0.0-beta.4",
3
+ "version": "20.0.0-beta.6",
4
4
  "description": "Box UI Elements",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -8,38 +8,48 @@ const SEC_IN_MS = 1e3;
8
8
  const YEAR_IN_MS = 3.154e10;
9
9
 
10
10
  describe('timeFromNow function', () => {
11
- it('should return correct year difference', () => {
12
- const ms = Date.now() + YEAR_IN_MS * 4; // Four years in the future
11
+ const originalDateNow = Date.now;
12
+ const fixedDate = 1629133900000; // Fixed timestamp for testing.
13
+ beforeAll(() => {
14
+ Date.now = jest.fn(() => fixedDate);
15
+ });
16
+
17
+ afterAll(() => {
18
+ Date.now = originalDateNow;
19
+ });
20
+
21
+ it('should return correct value and unit for time difference greater than a year', () => {
22
+ const ms = fixedDate + YEAR_IN_MS * 4;
13
23
  expect(timeFromNow(ms)).toEqual({ value: 4, unit: 'year' });
14
24
  });
15
25
 
16
- it('should return correct week difference', () => {
17
- const ms = Date.now() + WEEK_IN_MS * 2; // Two weeks in the future
26
+ it('should return correct value and unit for time difference greater than a week', () => {
27
+ const ms = fixedDate + WEEK_IN_MS * 2;
18
28
  expect(timeFromNow(ms)).toEqual({ value: 2, unit: 'week' });
19
29
  });
20
30
 
21
- it('should return correct day difference', () => {
22
- const ms = Date.now() + DAY_IN_MS * 2; // Two days in the future
31
+ it('should return correct value and unit for time difference greater than a day', () => {
32
+ const ms = fixedDate + DAY_IN_MS * 2;
23
33
  expect(timeFromNow(ms)).toEqual({ value: 2, unit: 'day' });
24
34
  });
25
35
 
26
- it('should return correct hour difference', () => {
27
- const ms = Date.now() + HOUR_IN_MS * 2; // Two hours in the future
36
+ it('should return correct value and unit for time difference greater than an hour', () => {
37
+ const ms = fixedDate + HOUR_IN_MS * 2;
28
38
  expect(timeFromNow(ms)).toEqual({ value: 2, unit: 'hour' });
29
39
  });
30
40
 
31
- it('should return correct minute difference', () => {
32
- const ms = Date.now() + MIN_IN_MS * 2; // Two minutes in the future
41
+ it('should return correct value and unit for time difference greater than a minute', () => {
42
+ const ms = fixedDate + MIN_IN_MS * 2;
33
43
  expect(timeFromNow(ms)).toEqual({ value: 2, unit: 'minute' });
34
44
  });
35
45
 
36
- it('should return correct second difference', () => {
37
- const ms = Date.now() + SEC_IN_MS * 2; // Two seconds in the future
46
+ it('should return correct value and unit for time difference greater than a second', () => {
47
+ const ms = fixedDate + SEC_IN_MS * 2;
38
48
  expect(timeFromNow(ms)).toEqual({ value: 2, unit: 'second' });
39
49
  });
40
50
 
41
51
  it('should return correct negative difference', () => {
42
- const ms = Date.now() - DAY_IN_MS * 2; // Two days in the past
52
+ const ms = fixedDate - DAY_IN_MS * 2;
43
53
  expect(timeFromNow(ms)).toEqual({ value: -2, unit: 'day' });
44
54
  });
45
55
  });