Skip to content

Commit d41d94b

Browse files
committed
refactor: Improve test date mocking, enforce strict equality, reorder imports, and remove unused styling.
1 parent e734843 commit d41d94b

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

src/views/Home/HomeWrapper.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { BIG_BREAKPOINT } from "@constants/BreakPoints";
21

3-
import type { FC } from "react";
42

53
import React from "react";
6-
74
import { useLocation } from "react-router";
85
import { styled } from "styled-components";
96

107
import SpeakersCarousel from "@components/Swiper/SpeakersCarousel";
8+
import { BIG_BREAKPOINT } from "@constants/BreakPoints";
119
import { ROUTE_2026_SPEAKERS } from "@constants/routes";
1210
import conferenceData from "@data/2026.json";
1311
import { useDocumentTitleUpdater } from "@hooks/useDocumentTitleUpdate";
@@ -16,6 +14,8 @@ import Faqs from "./components/Faqs/Faqs";
1614
import HomeWTC from "./components/HomeWTC/HomeWTC";
1715
import Sponsors from "./components/Sponsors/Sponsors";
1816

17+
import type { FC } from "react";
18+
1919
const StyledContainer = styled.div`
2020
padding-bottom: 10rem;
2121

src/views/QrCode/QrCode.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ const QrCode: FC<React.PropsWithChildren<QrCodeProps>> = ({
7171
const qrCode: number = parseInt(e.target.value);
7272
e.preventDefault();
7373
setSelectedTrack(qrCode);
74-
setSession(availableTalks?.filter((talk) => talk.roomId == qrCode)[0]);
75-
if (session != undefined)
74+
setSession(availableTalks?.filter((talk) => talk.roomId === qrCode)[0]);
75+
if (session !== undefined)
7676
setQrValue(
7777
`https://openfeedback.io/${openFeedbackId}/${format(parseISO(session.startsAt), "yyyy-MM-dd")}/${session.id}`,
7878
);

src/views/Speakers/Speakers.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ describe("Speakers component", () => {
100100

101101
// This ensures that both new Date() and Date.now() use our mock date
102102
global.Date = class extends Date {
103-
constructor(...args) {
103+
constructor(...args: unknown[]) {
104+
super();
104105
if (args.length === 0) {
105106
return mockDate;
106107
}
107-
return super(...args);
108+
return new originalDate(...(args as ConstructorParameters<typeof originalDate>));
108109
}
109110

110111
static now() {
@@ -136,11 +137,12 @@ describe("Speakers component", () => {
136137

137138
// This ensures that both new Date() and Date.now() use our mock date
138139
global.Date = class extends Date {
139-
constructor(...args) {
140+
constructor(...args: unknown[]) {
141+
super();
140142
if (args.length === 0) {
141143
return mockDate;
142144
}
143-
return super(...args);
145+
return new originalDate(...(args as ConstructorParameters<typeof originalDate>));
144146
}
145147

146148
static now() {

src/views/Travel/VenueWTC.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ const StyledVenue = styled.div`
6363
}
6464
`;
6565

66-
const StyledTrainLine = styled.span`
67-
background-color: #00f200;
68-
font-weight: bold;
69-
padding: 1px 2px;
70-
font-family: sans-serif;
71-
font-size: 12px;
72-
`;
7366
export const StyledLessIcon = styled.img`
7467
position: absolute;
7568
left: -1rem;

0 commit comments

Comments
 (0)