spb/tendril Public
Tendril — web ingestion platform (scrape/crawl/map/search) on macOS Apple Silicon: WebKit fidelity, authenticated pages, deterministic testable extraction. A self-hosted Firecrawl alternative.
JavaScript 82.6%
TypeScript 11.8%
HTML 5.3%
1// author: simon-pierre boucher <contact@spboucher.ai>2import { afterAll, beforeAll, describe, expect, it } from "vitest";3import type { FastifyInstance } from "fastify";4import { buildApp } from "./app.js";56let app: FastifyInstance;78beforeAll(async () => {9 app = buildApp();10 await app.ready();11});1213afterAll(async () => {14 await app.close();15});1617describe("api", () => {18 it("serves a shallow healthz", async () => {19 const res = await app.inject({ method: "GET", url: "/healthz" });20 expect(res.statusCode).toBe(200);21 expect(res.json()).toMatchObject({ success: true, data: { status: "ok" } });22 });2324 it("rejects an invalid scrape body with ERR_INVALID_URL and a requestId", async () => {25 const res = await app.inject({ method: "POST", url: "/v1/scrape", payload: { url: "not-a-url" } });26 expect(res.statusCode).toBe(400);27 const body = res.json();28 expect(body.success).toBe(false);29 expect(body.error.code).toBe("ERR_INVALID_URL");30 expect(body.requestId).toMatch(/^tdr_req_/);31 expect(res.headers["x-request-id"]).toMatch(/^tdr_req_/);32 });3334 it("rejects unknown fields (strict schema)", async () => {35 const res = await app.inject({36 method: "POST",37 url: "/v1/scrape",38 payload: { url: "https://example.com", bogus: true },39 });40 expect(res.statusCode).toBe(400);41 });42});43