release: WRNexusJS 0.4.0
This commit is contained in:
@@ -3,6 +3,14 @@ import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const showcaseRoot = join(import.meta.dir, "..");
|
||||
const repositoryRoot = join(showcaseRoot, "..", "..");
|
||||
const packageComponentPath = join(
|
||||
repositoryRoot,
|
||||
"packages",
|
||||
"captcha",
|
||||
"components",
|
||||
"Captcha.wrn",
|
||||
);
|
||||
|
||||
function path(relativePath: string): string {
|
||||
return join(showcaseRoot, relativePath);
|
||||
@@ -19,7 +27,6 @@ describe("CAPTCHA showcase structure", () => {
|
||||
"app/pages/captcha.wrn",
|
||||
"app/pages/protected.wrn",
|
||||
"app/pages/styles.wrn",
|
||||
"app/components/Captcha.wrn",
|
||||
"app/api/contact.ts",
|
||||
"app/api/page-grant.ts",
|
||||
"app/schemas/contact.ts",
|
||||
@@ -41,7 +48,8 @@ describe("CAPTCHA showcase structure", () => {
|
||||
expect(packageJson).toContain('"@iconify-json/lucide"');
|
||||
expect(packageJson).toContain('"@iconify/tailwind4"');
|
||||
expect(styles).toContain('@plugin "@iconify/tailwind4";');
|
||||
expect(styles).toContain('@source "../../../packages/captcha/components/*.wrn";');
|
||||
expect(styles).not.toContain("packages/captcha/components");
|
||||
expect(read("wrnexus.config.ts")).not.toContain("includePackageSources: false");
|
||||
});
|
||||
|
||||
test("documents every bundled challenge mode", () => {
|
||||
@@ -72,7 +80,6 @@ describe("CAPTCHA showcase structure", () => {
|
||||
expect(source).toContain('showListen="false"');
|
||||
});
|
||||
|
||||
|
||||
test("documents every generated image renderer and random pool controls", () => {
|
||||
const source = read("app/pages/styles.wrn");
|
||||
const styles = [
|
||||
@@ -170,15 +177,23 @@ describe("CAPTCHA showcase integration", () => {
|
||||
expect(grantRoute).toContain("Response.redirect");
|
||||
});
|
||||
|
||||
test("registers the CAPTCHA plugin and DevToolbar audit", () => {
|
||||
const source = read("wrnexus.config.ts");
|
||||
test("auto-discovers the CAPTCHA package without manual plugin or script wiring", () => {
|
||||
const config = read("wrnexus.config.ts");
|
||||
const packageJson = read("package.json");
|
||||
const component = readFileSync(packageComponentPath, "utf8");
|
||||
|
||||
expect(source).toContain("captchaPlugin");
|
||||
expect(source).toContain("enableDevToolbar: true");
|
||||
expect(packageJson).toContain('"@wrnexus/captcha": "workspace:*"');
|
||||
expect(existsSync(path("app/components/Captcha.wrn"))).toBe(false);
|
||||
expect(existsSync(packageComponentPath)).toBe(true);
|
||||
expect(config).not.toContain("captchaPlugin");
|
||||
expect(config).not.toContain("plugins:");
|
||||
expect(component).toContain('data-wrnexus-runtime="captcha"');
|
||||
expect(component).not.toContain("<script");
|
||||
expect(component).not.toContain("captcha.js");
|
||||
});
|
||||
|
||||
test("ships the expected component events and response field", () => {
|
||||
const source = read("app/components/Captcha.wrn");
|
||||
const source = readFileSync(packageComponentPath, "utf8");
|
||||
const expectedEvents = [
|
||||
"ready",
|
||||
"challenge",
|
||||
@@ -195,14 +210,14 @@ describe("CAPTCHA showcase integration", () => {
|
||||
|
||||
expect(source).toContain('name = "wrn-captcha-response"');
|
||||
expect(source).toContain('responseField = "wrn-captcha-response"');
|
||||
expect(source).toContain('disturbance = 50');
|
||||
expect(source).toContain("disturbance = 50");
|
||||
expect(source).toContain('size = "normal"');
|
||||
expect(source).toContain('showListen = true');
|
||||
expect(source).toContain("showListen = true");
|
||||
expect(source).toContain('imageStyle = "random"');
|
||||
expect(source).toContain('allowedStyles = ""');
|
||||
expect(source).toContain('excludedStyles = ""');
|
||||
expect(source).toContain('randomizeStyle = false');
|
||||
expect(source).toContain('data-captcha-not-robot-button');
|
||||
expect(source).toContain("randomizeStyle = false");
|
||||
expect(source).toContain("data-captcha-not-robot-button");
|
||||
|
||||
for (const eventName of expectedEvents) {
|
||||
expect(source).toContain(`@event ${eventName} = function`);
|
||||
|
||||
Reference in New Issue
Block a user