Skip to content

Commit 4266268

Browse files
committed
Fix: Linting issues
1 parent 0c2415a commit 4266268

File tree

5 files changed

+14
-448
lines changed

5 files changed

+14
-448
lines changed

src/routes/order-confirmation/order-confirmation.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { render, screen } from "@testing-library/react";
2-
import { describe, expect, it, vi } from "vitest";
2+
import { describe, expect, it } from "vitest";
33

44
import OrderConfirmation from ".";
5+
56
import type { Route } from "./+types";
67

78
// Creates minimal test props for OrderConfirmation component
89
const createTestProps = (orderId = "test-123"): Route.ComponentProps => ({
910
loaderData: { orderId },
10-
params: vi.fn() as any,
11-
matches: vi.fn() as any,
11+
params: { orderId },
12+
// Hack to satisfy type requirements
13+
matches: [] as unknown as Route.ComponentProps["matches"],
1214
});
1315

1416
describe("OrderConfirmation", () => {

src/routes/product/product.test.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { Route } from "./+types";
1111

1212
// Helper function to create a test navigation object
1313
const createTestNavigation = (overrides = {}) => ({
14-
state: "idle",
14+
state: "idle" as const,
1515
location: undefined,
1616
formMethod: undefined,
1717
formAction: undefined,
@@ -33,8 +33,9 @@ const createTestProps = (
3333
productData: Partial<ProductType> = {}
3434
): Route.ComponentProps => ({
3535
loaderData: { product: createTestProduct(productData) },
36-
params: vi.fn() as any,
37-
matches: vi.fn() as any,
36+
params: { id: "123" },
37+
// Hack to satisfy type requirements
38+
matches: [] as unknown as Route.ComponentProps["matches"],
3839
});
3940

4041
describe("Product Component", () => {
@@ -133,7 +134,7 @@ describe("Product Component", () => {
133134
const props = createTestProps();
134135
const expectedNavigation = createTestNavigation({ state: "submitting" });
135136
// Step 2: Mock - Override navigation state to simulate loading
136-
vi.mocked(useNavigation).mockReturnValue(expectedNavigation as any);
137+
vi.mocked(useNavigation).mockReturnValue(expectedNavigation);
137138
// Step 3: Call
138139
render(<Product {...props} />);
139140
// Step 4: Verify

src/services/order.service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe("Order Service", () => {
9494
expect(order).toEqual({
9595
...prismaOrder,
9696
totalAmount: Number(prismaOrder.totalAmount),
97-
items: prismaOrder.items.map((item: any) => ({
97+
items: prismaOrder.items.map((item) => ({
9898
...item,
9999
price: Number(item.price),
100100
imgSrc: item.imgSrc ?? "",
@@ -140,7 +140,7 @@ describe("Order Service", () => {
140140
prismaOrders.map((order) => ({
141141
...order,
142142
totalAmount: Number(order.totalAmount),
143-
items: order.items.map((item: any) => ({
143+
items: order.items.map((item) => ({
144144
...item,
145145
price: Number(item.price),
146146
imgSrc: item.imgSrc ?? "",

src/services/user.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { prisma } from "@/db/prisma";
12
import { hashPassword } from "@/lib/security";
23
import type { User, AuthResponse } from "@/models/user.model";
3-
import { prisma } from "@/db/prisma";
44
import { getSession } from "@/session.server";
55

66
export async function updateUser(
@@ -14,7 +14,7 @@ export async function updateUser(
1414
throw new Error("User not authenticated");
1515
}
1616

17-
const data = { ...updatedUser } as any;
17+
const data = { ...updatedUser };
1818

1919
if (updatedUser.password) {
2020
const hashedPassword = await hashPassword(updatedUser.password);

0 commit comments

Comments
 (0)