|
| 1 | +import { describe, it } from "node:test" |
| 2 | +import assert from "node:assert/strict" |
| 3 | +import { METHODS, getMethod, isIdempotent } from "../../extension/src/contract/v1/index.js" |
| 4 | + |
| 5 | +describe("contract v1: dom.resolve and dom.waitForSelector", () => { |
| 6 | + it("both methods are registered", () => { |
| 7 | + const names = METHODS.map((m) => m.name) |
| 8 | + assert.ok(names.includes("dom.resolve"), "dom.resolve missing from catalogue") |
| 9 | + assert.ok(names.includes("dom.waitForSelector"), "dom.waitForSelector missing from catalogue") |
| 10 | + }) |
| 11 | + |
| 12 | + it("dom.resolve is read-only and retry-safe", () => { |
| 13 | + const m = getMethod("dom.resolve") |
| 14 | + assert.equal(m.mutates, false) |
| 15 | + assert.equal(m.idempotent, true) |
| 16 | + assert.notEqual(m.retryHint, "abort") |
| 17 | + }) |
| 18 | + |
| 19 | + it("dom.waitForSelector is read-only and retry-safe", () => { |
| 20 | + const m = getMethod("dom.waitForSelector") |
| 21 | + assert.equal(m.mutates, false) |
| 22 | + assert.equal(m.idempotent, true) |
| 23 | + }) |
| 24 | + |
| 25 | + it("isIdempotent helper agrees with catalogue", () => { |
| 26 | + assert.equal(isIdempotent("dom.resolve"), true) |
| 27 | + assert.equal(isIdempotent("dom.waitForSelector"), true) |
| 28 | + }) |
| 29 | +}) |
0 commit comments