Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/probe-worker.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ test("sonnet-2 registration is disabled by default and fails closed without laun
}
});

test("closed sonnet-2 registration performs no network or publish work", async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = async () => {
throw new Error("closed registration must not fetch");
};
try {
assert.deepEqual(await publishSonnet2RegistrationOnce({
SONNET_2_REGISTRATION_ENABLED: "true",
SONNET_2_REGISTRATION_CLOSED: "true"
}), { action: "closed" });
} finally {
globalThis.fetch = originalFetch;
}
});

test("detects only Mabolla's exact sonnet-2 writer registration", () => {
const exact = "{\"type\":\"sonnet.register.v1\",\"contest_id\":\"sonnet-2\",\"role\":\"writer\",\"x_account_url\":\"https://x.com/CNft35\",\"request_id\":\"mabolla-register-sonnet2-writer-1\"}";
assert.equal(hasSonnet2Registration([{ from: "did:key:z6MkfRm7VkjC52pff11L12dbFkChhVkiZqv5Wwd7VMo3fCsG", text: exact }]), true);
Expand Down
3 changes: 2 additions & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"PROBE_CONTEXT_MESSAGES": "12",
"SONNET_RECRUITMENT_ENABLED": "true",
"SONNET_RECRUITMENT_CLOSED": "true",
"SONNET_2_REGISTRATION_ENABLED": "true"
"SONNET_2_REGISTRATION_ENABLED": "true",
"SONNET_2_REGISTRATION_CLOSED": "true"
}
}
Loading