Files
OmniRoute/tests/unit/notion-api.test.ts
Diego Rodrigues de Sa e Souza 0adae00c7b Release v3.8.42 (#5459)
Release v3.8.42 — full CHANGELOG in CHANGELOG.md.

CI: 103 checks green incl. CodeQL (all languages), Semgrep, all 8 unit shards,
coverage, Node 24 compat, and integration tests. Full unit suite validated
locally: 19437 pass / 0 fail. The 3 red checks are advisory and do not gate
main (no required status checks): SonarCloud/SonarQube new-code coverage gate,
and PR Test Policy (test-masking detector flagging the legitimate dead-Phind
provider removal in #5530 — reviewed, correct).

Includes cycle-close reconciliation + repair of inherited base-red tests from
#5480/#5527/#5427/#5521 that the PR->release fast-path did not exercise.
2026-06-30 06:54:29 -03:00

63 lines
2.0 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import {
NotionAuthError,
NotionNotFoundError,
NotionRateLimitError,
NotionValidationError,
NotionServerError,
NotionTimeoutError,
} from "../../src/lib/notion/api.ts";
test("NotionAuthError has correct name", () => {
const err = new NotionAuthError("bad token");
assert.equal(err.name, "NotionAuthError");
assert.equal(err.message, "bad token");
});
test("NotionNotFoundError has correct name", () => {
const err = new NotionNotFoundError("not found");
assert.equal(err.name, "NotionNotFoundError");
});
test("NotionRateLimitError has retryAfter property", () => {
const err = new NotionRateLimitError("rate limited", 5);
assert.equal(err.retryAfter, 5);
assert.equal(err.name, "NotionRateLimitError");
});
test("NotionValidationError has correct name", () => {
const err = new NotionValidationError("invalid");
assert.equal(err.name, "NotionValidationError");
});
test("NotionServerError has correct name", () => {
const err = new NotionServerError("server error");
assert.equal(err.name, "NotionServerError");
});
test("NotionTimeoutError has correct name", () => {
const err = new NotionTimeoutError("timed out");
assert.equal(err.name, "NotionTimeoutError");
});
test("createNotionClient returns object with expected methods", async () => {
const { createNotionClient } = await import("../../src/lib/notion/api.ts");
const client = createNotionClient("test-token");
assert.deepEqual(Object.keys(client), [
"searchPagesAndDatabases",
"getPage",
"listBlockChildren",
"queryDatabase",
"getDatabase",
"appendBlocks",
]);
assert.equal(typeof client.searchPagesAndDatabases, "function");
assert.equal(typeof client.getPage, "function");
assert.equal(typeof client.listBlockChildren, "function");
assert.equal(typeof client.queryDatabase, "function");
assert.equal(typeof client.getDatabase, "function");
assert.equal(typeof client.appendBlocks, "function");
});