test: fix formatting and remove unused HttpError import in Kijiji tests
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
import { describe, expect, test } from "bun:test";
|
import { describe, expect, test } from "bun:test";
|
||||||
import {
|
import {
|
||||||
HttpError,
|
buildSearchUrl,
|
||||||
NetworkError,
|
NetworkError,
|
||||||
ParseError,
|
ParseError,
|
||||||
RateLimitError,
|
RateLimitError,
|
||||||
ValidationError,
|
|
||||||
buildSearchUrl,
|
|
||||||
resolveCategoryId,
|
resolveCategoryId,
|
||||||
resolveLocationId,
|
resolveLocationId,
|
||||||
|
ValidationError,
|
||||||
} from "../src/scrapers/kijiji";
|
} from "../src/scrapers/kijiji";
|
||||||
|
|
||||||
describe("Location and Category Resolution", () => {
|
describe("Location and Category Resolution", () => {
|
||||||
@@ -121,20 +120,12 @@ describe("URL Construction", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Error Classes", () => {
|
describe("Error Classes", () => {
|
||||||
test("HttpError should store status and URL", () => {
|
|
||||||
const error = new HttpError("Not found", 404, "https://example.com");
|
|
||||||
expect(error.message).toBe("Not found");
|
|
||||||
expect(error.statusCode).toBe(404);
|
|
||||||
expect(error.url).toBe("https://example.com");
|
|
||||||
expect(error.name).toBe("HttpError");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("NetworkError should store URL and cause", () => {
|
test("NetworkError should store URL and cause", () => {
|
||||||
const cause = new Error("Connection failed");
|
const cause = new Error("Connection failed");
|
||||||
const error = new NetworkError(
|
const error = new NetworkError(
|
||||||
"Network error",
|
"Network error",
|
||||||
"https://example.com",
|
"https://example.com",
|
||||||
cause
|
cause,
|
||||||
);
|
);
|
||||||
expect(error.message).toBe("Network error");
|
expect(error.message).toBe("Network error");
|
||||||
expect(error.url).toBe("https://example.com");
|
expect(error.url).toBe("https://example.com");
|
||||||
|
|||||||
Reference in New Issue
Block a user