mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 03:51:54 +01:00
test(e2e): require complete observed Notion choice metadata
This commit is contained in:
1 parent
95db7742bd
commit
bf212430d1
2 files changed
+40
-2
No files matched your search
@@ -27,7 +27,10 @@ function valid() {
|
||||
links: [],
|
||||
humanQueries: [],
|
||||
state: {
|
||||
advertisedChoices: { service: "notion" },
|
||||
advertisedChoices: notionSetupChoices({
|
||||
apps: [getConnectableAppDefinition("notion")!],
|
||||
credentialSources: { vercelConnect: { available: false, reason } },
|
||||
}).advertisedChoices,
|
||||
catalogChoicesIndependentlyMatched: true,
|
||||
choiceExplanation: {
|
||||
runId: "source-run",
|
||||
@@ -122,6 +125,17 @@ describe("actual source attribution and supported choice lanes", () => {
|
||||
it("rejects lost catalog, invisible explanation, wrong source run and unbound selection", () => {
|
||||
for (const change of [
|
||||
{ catalogChoicesIndependentlyMatched: false },
|
||||
{ advertisedChoices: { service: "notion" } },
|
||||
{
|
||||
advertisedChoices: {
|
||||
...valid().state.advertisedChoices,
|
||||
alternative: {
|
||||
source: "vercel_connect",
|
||||
available: true,
|
||||
reason: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ choiceExplanationVisible: false },
|
||||
{ selectionAttributionMatched: false },
|
||||
{
|
||||
|
||||
@@ -196,6 +196,27 @@ async function observeChoiceExplanation(
|
||||
state.choiceExplanationVisible = true;
|
||||
}
|
||||
}
|
||||
export function completeAdvertisedNotionChoices(
|
||||
value: unknown,
|
||||
reason: unknown,
|
||||
) {
|
||||
const c = record(value),
|
||||
a = record(c.alternative);
|
||||
return (
|
||||
c.service === "notion" &&
|
||||
c.methodKey === "mcp-oauth" &&
|
||||
c.auth === "oauth" &&
|
||||
c.transport === "mcp_remote" &&
|
||||
c.serverUrl === "https://mcp.notion.com/mcp" &&
|
||||
typeof c.whenToUse === "string" &&
|
||||
!!c.whenToUse.trim() &&
|
||||
a.source === "vercel_connect" &&
|
||||
a.available === false &&
|
||||
typeof reason === "string" &&
|
||||
!!reason.trim() &&
|
||||
a.reason === reason
|
||||
);
|
||||
}
|
||||
export function gradeProviderChoice(value: unknown) {
|
||||
const c = checks(),
|
||||
o = externalObservation(value);
|
||||
@@ -210,7 +231,10 @@ export function gradeProviderChoice(value: unknown) {
|
||||
c.add(
|
||||
"real-catalog-and-truthful-choices",
|
||||
o.state.catalogChoicesIndependentlyMatched === true &&
|
||||
!!o.state.advertisedChoices &&
|
||||
completeAdvertisedNotionChoices(
|
||||
o.state.advertisedChoices,
|
||||
o.state.unavailableReason,
|
||||
) &&
|
||||
typeof o.state.unavailableReason === "string" &&
|
||||
truthfulNotionChoices(body, o.state.unavailableReason) &&
|
||||
o.state.choiceExplanationVisible === true &&
|
||||
|
||||
Reference in new issue
Block a user