Match the repo's per-integration CI/CD convention (vercel-ai / pi-agent pattern): - n8n-nodes-mem0-checks.yml (lint + build + dist verify) and n8n-nodes-mem0-cd.yml (npm publish --provenance via OIDC, dispatched by the release router on tag n8n-nodes-mem0-v*). - zapier-mem0-checks.yml (zapier validate) and zapier-mem0-cd.yml (manual zapier push; requires ZAPIER_DEPLOY_KEY). Zapier deploys to Zapier's platform, not npm, so it is not in the release router. - Wire both packages into ci-gate.yml (path filters + call jobs + gate). - Register the n8n tag prefix in release.yml and document it + the Zapier manual-deploy in AGENTS.md. - Skip the Zapier E2E suite when MEM0_API_KEY is absent so CI is green offline (it still runs locally with a key).
81 lines
2.4 KiB
JavaScript
81 lines
2.4 KiB
JavaScript
'use strict';
|
|
|
|
/* global describe, it, expect, beforeAll */
|
|
|
|
const zapier = require('zapier-platform-core');
|
|
const App = require('../index');
|
|
|
|
const appTester = zapier.createAppTester(App);
|
|
|
|
const authData = {
|
|
apiKey: process.env.MEM0_API_KEY,
|
|
baseUrl: process.env.MEM0_BASE_URL || 'https://api.mem0.ai',
|
|
};
|
|
|
|
const userId = `zapier-e2e-${Date.now()}`;
|
|
|
|
// The E2E suite hits the live Mem0 API, so it only runs when MEM0_API_KEY is
|
|
// set (locally / with a secret). In CI without a key it is skipped, not failed.
|
|
const describeE2E = authData.apiKey ? describe : describe.skip;
|
|
|
|
describeE2E('Mem0 Zapier integration (E2E)', () => {
|
|
|
|
it('authentication.test succeeds', async () => {
|
|
const res = await appTester(App.authentication.test, { authData });
|
|
expect(res.status).toBe(200);
|
|
});
|
|
|
|
it('adds, searches, lists, and deletes a memory', async () => {
|
|
// Add (async, wait for completion)
|
|
const added = await appTester(App.creates.add_memory.operation.perform, {
|
|
authData,
|
|
inputData: {
|
|
content: 'I love hiking in the Alps and my favorite food is sushi',
|
|
user_id: userId,
|
|
waitForCompletion: true,
|
|
},
|
|
});
|
|
expect(added.status).toBe('SUCCEEDED');
|
|
|
|
// Search
|
|
const found = await appTester(App.searches.search_memories.operation.perform, {
|
|
authData,
|
|
inputData: { query: 'outdoor activities', user_id: userId, limit: 5 },
|
|
});
|
|
expect(Array.isArray(found)).toBe(true);
|
|
expect(found.length).toBeGreaterThan(0);
|
|
|
|
// Get all
|
|
const all = await appTester(App.searches.get_memories.operation.perform, {
|
|
authData,
|
|
inputData: { user_id: userId },
|
|
});
|
|
expect(Array.isArray(all)).toBe(true);
|
|
expect(all.length).toBeGreaterThan(0);
|
|
|
|
// Cleanup: delete every memory we created
|
|
for (const mem of all) {
|
|
await appTester(App.creates.delete_memory.operation.perform, {
|
|
authData,
|
|
inputData: { memory_id: mem.id },
|
|
});
|
|
}
|
|
|
|
const afterDelete = await appTester(App.searches.get_memories.operation.perform, {
|
|
authData,
|
|
inputData: { user_id: userId },
|
|
});
|
|
expect(afterDelete.length).toBe(0);
|
|
});
|
|
|
|
it('surfaces API errors instead of returning an empty array (search needs a filter)', async () => {
|
|
// filters is required by the API; omitting it must throw, not return [].
|
|
await expect(
|
|
appTester(App.searches.search_memories.operation.perform, {
|
|
authData,
|
|
inputData: { query: 'anything' },
|
|
}),
|
|
).rejects.toThrow();
|
|
});
|
|
});
|