refactor: migrate legacy wire namespace to wrn
Quality / quality (ubuntu-latest) (push) Failing after 9m49s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 18:51:15 +05:30
parent ec23dd4c93
commit 2c960fc1dc
488 changed files with 27306 additions and 19063 deletions
+16 -16
View File
@@ -74,13 +74,13 @@ test("browser validation displays the serialized custom required message", () =>
<input name="email">
<span data-error="email"></span>
</form>`;
win.__wireSchemas = { login: schema.describe() };
win.__wrnSchemas = { login: schema.describe() };
(globalThis as Record<string, unknown>).window = win;
(globalThis as Record<string, unknown>).document = win.document;
try {
(0, eval)(VALIDATE_RUNTIME);
const runtime = win.__wireValidate as { init(root: Document): void };
const runtime = win.__wrnValidate as { init(root: Document): void };
runtime.init(win.document as unknown as Document);
const form = win.document.querySelector("form")!;
win.document.querySelector("input")!.dispatchEvent(windowEvent(win, "blur", { bubbles: true }));
@@ -219,12 +219,12 @@ test("parseEnv throws one readable error listing every missing/invalid var", ()
});
test("parseEnv defaults to reading the ambient environment", () => {
process.env.WIRE_TEST_ENV_VAR = "present";
const env = parseEnv<{ WIRE_TEST_ENV_VAR: string }>(
v.object({ WIRE_TEST_ENV_VAR: v.string().min(1) }),
process.env.WRN_TEST_ENV_VAR = "present";
const env = parseEnv<{ WRN_TEST_ENV_VAR: string }>(
v.object({ WRN_TEST_ENV_VAR: v.string().min(1) }),
);
expect(env.WIRE_TEST_ENV_VAR).toBe("present");
delete process.env.WIRE_TEST_ENV_VAR;
expect(env.WRN_TEST_ENV_VAR).toBe("present");
delete process.env.WRN_TEST_ENV_VAR;
});
test("object schemas can be extended without mutating package defaults", () => {
@@ -255,15 +255,15 @@ test("validation can bind after a package registers a missing schema", () => {
<input name="identifier">
<span data-error="identifier"></span>
</form>`;
win.__wireSchemas = {};
win.__wrnSchemas = {};
(globalThis as Record<string, unknown>).window = win;
(globalThis as Record<string, unknown>).document = win.document;
try {
(0, eval)(VALIDATE_RUNTIME);
const runtime = win.__wireValidate as { init(root: Document): void };
const runtime = win.__wrnValidate as { init(root: Document): void };
runtime.init(win.document as unknown as Document);
win.__wireSchemas = {
win.__wrnSchemas = {
"late-schema": v
.object({ identifier: v.string().required("Enter an identifier") })
.describe(),
@@ -285,12 +285,12 @@ test("schema-backed forms validate on input, change, and blur and synchronize fi
const win = new Window() as unknown as Window & Record<string, unknown>;
win.document.body.innerHTML = `
<form data-schema="profile">
<div class="wire-next--field" data-invalid="false">
<div class="wrn-next--field" data-invalid="false">
<input name="email">
<span data-error="email"></span>
</div>
</form>`;
win.__wireSchemas = {
win.__wrnSchemas = {
profile: v
.object({ email: v.string().required("Enter an email").email("Use a valid email") })
.describe(),
@@ -301,7 +301,7 @@ test("schema-backed forms validate on input, change, and blur and synchronize fi
try {
(0, eval)(VALIDATE_RUNTIME);
const input = win.document.querySelector("input") as HappyDOMHTMLInputElement;
const field = win.document.querySelector(".wire-next--field") as HappyDOMHTMLElement;
const field = win.document.querySelector(".wrn-next--field") as HappyDOMHTMLElement;
const error = win.document.querySelector("[data-error=email]") as HappyDOMHTMLElement;
input.dispatchEvent(windowEvent(win, "input", { bubbles: true }));
@@ -327,7 +327,7 @@ test("submit guards run only after schema fields are valid", () => {
<input name="email">
<span data-error="email"></span>
</form>`;
win.__wireSchemas = {
win.__wrnSchemas = {
guarded: v.object({ email: v.string().required("Enter an email") }).describe(),
};
(globalThis as Record<string, unknown>).window = win;
@@ -336,10 +336,10 @@ test("submit guards run only after schema fields are valid", () => {
try {
(0, eval)(VALIDATE_RUNTIME);
const form = win.document.querySelector("form")! as HappyDOMHTMLFormElement & {
__wireSubmitGuards?: Array<() => boolean>;
__wrnSubmitGuards?: Array<() => boolean>;
};
let guardCalls = 0;
form.__wireSubmitGuards = [
form.__wrnSubmitGuards = [
() => {
guardCalls += 1;
return false;