mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(spec): reject an unknown object-selector key in the web runtime
Same rule and the same message as the native side: a key no element can carry throws instead of matching nothing. The accepted list is one list, committed as a fixture both suites assert, so a spec cannot be accepted by one runtime and rejected by the other.
This commit is contained in:
1 parent
1332471b72
commit
269574706d
5 files changed
+239
-10
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { test } from "node:test";
|
||||
|
||||
import { __testing__ } from "../src/web-runtime.ts";
|
||||
|
||||
const { SELECTOR_KEYS } = __testing__;
|
||||
|
||||
const goldenPath = fileURLToPath(new URL("./fixtures/selector-keys.json", import.meta.url));
|
||||
const golden: string[] = JSON.parse(readFileSync(goldenPath, "utf8"));
|
||||
|
||||
// Both runtimes reject an object-selector key they do not know, so the two key
|
||||
// lists have to be one list. Were they to drift, a spec would be accepted by
|
||||
// the runtime that lists the key and fail the run on the one that does not, and
|
||||
// the difference would only show on the platform nobody ran first.
|
||||
// internal/hierarchy/selector_keys_test.go asserts the SAME file from the
|
||||
// native side.
|
||||
test("the web key list is the cross-runtime list", () => {
|
||||
assert.deepEqual([...SELECTOR_KEYS], golden);
|
||||
});
|
||||
Reference in new issue
Block a user