aboutsummaryrefslogtreecommitdiff
path: root/castle-search/test/extraction-config.test.ts
blob: 43d2108d3f27a68508e5213668f720bf1439546e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import assert from "node:assert/strict";
import { test } from "node:test";

import { getEngine } from "../src/engines.ts";

test("duckduckgo can tell a genuine zero-hit page from broken markup", () => {
  // Its "no results" notice is itself a `.result`, so without a marker an empty
  // search looks like an extractor failure.
  assert.equal(getEngine("duckduckgo").extraction.emptyMarker, ".no-results");
});

test("brave falls back to main when #results is absent", () => {
  const roots = getEngine("brave").extraction.roots;
  assert.ok(roots.includes("main"));
  assert.equal(roots[0], "#results");
});