-
Notifications
You must be signed in to change notification settings - Fork 13.8k
fix: use correct start dates on omnichannel reports #35100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
591ba57
test: correct start dates on omnichannel reports
MartinSchoeler c46e0ea
Create kind-geckos-heal.md
MartinSchoeler cf45b95
fix: use correct start dates on omnichannel reports
MartinSchoeler a81440b
fix test
MartinSchoeler f4c3277
fix reviews
MartinSchoeler d1380f2
fix: QA
MartinSchoeler c7869dc
fix: QA
MartinSchoeler eb57f33
Merge branch 'develop' into fix/charts-day
MartinSchoeler 03c3b41
Merge branch 'develop' into fix/charts-day
MartinSchoeler 7c7124e
Merge branch 'develop' into fix/charts-day
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@rocket.chat/meteor": patch | ||
| --- | ||
|
|
||
| Fixes incorrect start date on omnichannel reports |
101 changes: 101 additions & 0 deletions
101
apps/meteor/client/components/dashboards/getClosedPeriod.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| import { getClosedPeriod } from './periods'; | ||
|
|
||
| jest.mock('moment', () => { | ||
| return () => jest.requireActual('moment')('2024-05-19T12:00:00.000Z'); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this month', () => { | ||
| const monthExpectedReturn = { | ||
| start: new Date('5/1/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('month')(true); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(monthExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(monthExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this year', () => { | ||
| const yearExpectedReturn = { | ||
| start: new Date('1/1/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('year')(true); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(yearExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(yearExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for last 6 months', () => { | ||
| const last6MonthsExpectedReturn = { | ||
| start: new Date('11/1/2023').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('month', 6)(true); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(last6MonthsExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(last6MonthsExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this week', () => { | ||
| const weekExpectedReturn = { | ||
| start: new Date('5/19/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('week')(true); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(weekExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(weekExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this month using local time', () => { | ||
| const monthExpectedReturn = { | ||
| start: new Date('5/1/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('month')(false); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(monthExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(monthExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this year using local time', () => { | ||
| const yearExpectedReturn = { | ||
| start: new Date('1/1/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('year')(false); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(yearExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(yearExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for last 6 months using local time', () => { | ||
| const last6MonthsExpectedReturn = { | ||
| start: new Date('11/1/2023').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('month', 6)(false); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(last6MonthsExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(last6MonthsExpectedReturn.end); | ||
| }); | ||
|
|
||
| it('should return the correct period range for this week using local time', () => { | ||
| const weekExpectedReturn = { | ||
| start: new Date('5/19/2024').toISOString().split('T')[0], | ||
| end: new Date('5/19/2024').toISOString().split('T')[0], | ||
| }; | ||
|
|
||
| const period = getClosedPeriod('week')(false); | ||
|
|
||
| expect(period.start.toISOString().split('T')[0]).toEqual(weekExpectedReturn.start); | ||
| expect(period.end.toISOString().split('T')[0]).toEqual(weekExpectedReturn.end); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.