From 144fec861fe53ee528f8f1e6bbec24e4432a9fb0 Mon Sep 17 00:00:00 2001 From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com> Date: Wed, 17 Feb 2021 18:52:27 +0100 Subject: [PATCH] fix: update tests --- .../LegalNoticeLink.spec.tsx.snap | 2 +- .../LegalNotice/legalNoticeLink.scss | 2 +- src/components/Options/OptionsView.tsx | 2 +- .../Options/profileTypeOptions.scss | 2 +- src/components/Options/reportOptions.scss | 3 +- src/utils/date.spec.ts | 28 ++++++++----------- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/components/LegalNotice/__snapshots__/LegalNoticeLink.spec.tsx.snap b/src/components/LegalNotice/__snapshots__/LegalNoticeLink.spec.tsx.snap index 21fd8812d..b46e53af7 100644 --- a/src/components/LegalNotice/__snapshots__/LegalNoticeLink.spec.tsx.snap +++ b/src/components/LegalNotice/__snapshots__/LegalNoticeLink.spec.tsx.snap @@ -8,7 +8,7 @@ exports[`LegalNoticeView component should be rendered correctly 1`] = ` className="legal-notice-content" > <div - className="legal-notice-header text-14-normal-uppercase" + className="legal-notice-header text-16-normal-uppercase" > LEGAL.TITLE_LEGAL </div> diff --git a/src/components/LegalNotice/legalNoticeLink.scss b/src/components/LegalNotice/legalNoticeLink.scss index f7cc9f029..ca6855f9e 100644 --- a/src/components/LegalNotice/legalNoticeLink.scss +++ b/src/components/LegalNotice/legalNoticeLink.scss @@ -8,7 +8,7 @@ align-items: center; justify-content: center; color: $white; - padding: 1.5rem 1.5rem 0; + padding: 1rem 1.5rem 0; margin-top: 1rem; .legal-notice-header { margin-bottom: 1.25rem; diff --git a/src/components/Options/OptionsView.tsx b/src/components/Options/OptionsView.tsx index e58f22d61..862b77ab0 100644 --- a/src/components/Options/OptionsView.tsx +++ b/src/components/Options/OptionsView.tsx @@ -29,8 +29,8 @@ const OptionsView: React.FC = () => { ></Header> <Content height={headerHeight}> <KonnectorViewerList isParam={true} /> - <ReportOptions /> <ProfileTypeOptions /> + <ReportOptions /> <FAQLink /> <LegalNoticeLink /> <div className="parameters-logos"> diff --git a/src/components/Options/profileTypeOptions.scss b/src/components/Options/profileTypeOptions.scss index e3c56b7b3..c3d8d3298 100644 --- a/src/components/Options/profileTypeOptions.scss +++ b/src/components/Options/profileTypeOptions.scss @@ -2,7 +2,7 @@ @import 'src/styles/base/breakpoint'; .profile-type-root { - margin-top: 2.5rem; + margin-top: 1.75rem; padding: 0 1.5rem; .profile-type-content { margin: 0 auto; diff --git a/src/components/Options/reportOptions.scss b/src/components/Options/reportOptions.scss index e1b6cef43..c8e10fbff 100644 --- a/src/components/Options/reportOptions.scss +++ b/src/components/Options/reportOptions.scss @@ -6,6 +6,7 @@ align-items: center; justify-content: center; padding: 0 1.5rem; + margin: 1rem 0; .report-option-content { width: 45.75rem; @media #{$large-phone} { @@ -13,7 +14,7 @@ } } .head { - margin: 2rem 0 1rem; + margin: 1rem 0; color: $grey-bright; } .switch-container { diff --git a/src/utils/date.spec.ts b/src/utils/date.spec.ts index 2a5137fb6..576c3e19c 100644 --- a/src/utils/date.spec.ts +++ b/src/utils/date.spec.ts @@ -1,7 +1,8 @@ import { FluidType } from 'enum/fluid.enum' import { TimeStep } from 'enum/timeStep.enum' import { DateTime } from 'luxon' -import { TimePeriod } from 'models' +import { Dataload, TimePeriod } from 'models' +import { graphData } from '../../test/__mocks__/datachartData.mock' import { compareDates, isLastDateReached, @@ -369,14 +370,7 @@ describe('date utils', () => { }) describe('convertDateToShortDateString test', () => { - const timePeriod: TimePeriod = { - startDate: DateTime.fromISO('2020-01-01T00:09:00.000Z', { - zone: 'utc', - }), - endDate: DateTime.fromISO('2020-12-29T23:59:59.999Z', { - zone: 'utc', - }), - } + const actualData: Dataload[] = graphData.actualData it('should return an empty string when the TimePeriod is unknown', () => { const result = convertDateToShortDateString(null, 99) @@ -386,29 +380,29 @@ describe('date utils', () => { describe('should return the correct short date string', () => { it('case HALF_AN_HOUR', () => { const result = convertDateToShortDateString( - timePeriod, + actualData, TimeStep.HALF_AN_HOUR ) - expect(result).toBe('mercredi 01 janvier') + expect(result).toBe('jeudi 01 octobre') }) it('case WEEK', () => { - const result = convertDateToShortDateString(timePeriod, TimeStep.WEEK) - expect(result).toBe('du 01/01 au 29/12') + const result = convertDateToShortDateString(actualData, TimeStep.WEEK) + expect(result).toBe('du 01/10 au 03/10') }) it('case DAY', () => { - const result = convertDateToShortDateString(timePeriod, TimeStep.DAY) - expect(result).toBe('janvier 2020') + const result = convertDateToShortDateString(actualData, TimeStep.DAY) + expect(result).toBe('octobre 2020') }) it('case MONTH', () => { - const result = convertDateToShortDateString(timePeriod, TimeStep.MONTH) + const result = convertDateToShortDateString(actualData, TimeStep.MONTH) expect(result).toBe('année 2020') }) it('case YEAR', () => { - const result = convertDateToShortDateString(timePeriod, TimeStep.YEAR) + const result = convertDateToShortDateString(actualData, TimeStep.YEAR) expect(result).toBe('de 2020 à 2020') }) }) -- GitLab