auto(agent): Add tests for contacts route
This commit is contained in:
parent
6d9bf4c461
commit
54d5b5d876
10 changed files with 115 additions and 119 deletions
47
backend/src/__tests__/auth.test.js
Normal file
47
backend/src/__tests__/auth.test.js
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert');
|
||||||
|
const { authenticate } = require('../routes/auth');
|
||||||
|
|
||||||
|
test('authenticate should reject invalid credentials', async () => {
|
||||||
|
const req = {
|
||||||
|
body: {
|
||||||
|
username: 'invalid',
|
||||||
|
password: 'wrong'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const res = {
|
||||||
|
status: (code) => {
|
||||||
|
res.statusCode = code;
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
json: (data) => {
|
||||||
|
res.data = data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await authenticate(req, res);
|
||||||
|
assert.strictEqual(res.statusCode, 401);
|
||||||
|
assert.deepStrictEqual(res.data, { error: 'Invalid credentials' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('authenticate should accept valid credentials', async () => {
|
||||||
|
const req = {
|
||||||
|
body: {
|
||||||
|
username: 'admin',
|
||||||
|
password: 'password'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const res = {
|
||||||
|
status: (code) => {
|
||||||
|
res.statusCode = code;
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
json: (data) => {
|
||||||
|
res.data = data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await authenticate(req, res);
|
||||||
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
assert.ok(res.data.token);
|
||||||
|
});
|
||||||
46
backend/src/__tests__/contacts.test.js
Normal file
46
backend/src/__tests__/contacts.test.js
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import * as assert from 'node:assert';
|
||||||
|
import { app } from '../app.js';
|
||||||
|
|
||||||
|
test('GET /contacts should return contacts', async () => {
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/contacts'
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(response.statusCode, 200);
|
||||||
|
assert.strictEqual(response.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('POST /contacts should create a new contact', async () => {
|
||||||
|
const newContact = {
|
||||||
|
name: 'John Doe',
|
||||||
|
email: 'john.doe@example.com',
|
||||||
|
phone: '123-456-7890'
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/contacts',
|
||||||
|
payload: newContact
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(response.statusCode, 201);
|
||||||
|
assert.strictEqual(response.headers['content-type'], 'application/json; charset=utf-8');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('POST /contacts should validate contact data', async () => {
|
||||||
|
const invalidContact = {
|
||||||
|
name: '',
|
||||||
|
email: 'invalid-email',
|
||||||
|
phone: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await app.inject({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/contacts',
|
||||||
|
payload: invalidContact
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(response.statusCode, 400);
|
||||||
|
});
|
||||||
|
|
@ -7,13 +7,13 @@
|
||||||
},
|
},
|
||||||
"last_task_id": "blocked-stall",
|
"last_task_id": "blocked-stall",
|
||||||
"last_task_source": "planner:blocked:stall",
|
"last_task_source": "planner:blocked:stall",
|
||||||
"last_verified_change": "status:832518282",
|
"last_verified_change": "status:875226225",
|
||||||
"last_task_status": "blocked",
|
"last_task_status": "blocked",
|
||||||
"last_smoke_exit": 0,
|
"last_smoke_exit": 0,
|
||||||
"last_integration_exit": 0,
|
"last_integration_exit": 0,
|
||||||
"last_verify_exit": 0,
|
"last_verify_exit": 0,
|
||||||
"stalled_count": 0,
|
"stalled_count": 0,
|
||||||
"updated_at": "2026-03-06T16:46:50Z",
|
"updated_at": "2026-03-06T19:18:10Z",
|
||||||
"goal_mode": "runtime",
|
"goal_mode": "runtime",
|
||||||
"plan_file": "/home/openclaw/.openclaw/workspace/helpyourneighbour/docs/plans/2026-03-06-session-startup.md"
|
"plan_file": "/home/openclaw/.openclaw/workspace/helpyourneighbour/docs/plans/2026-03-06-session-startup.md"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
||||||
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
||||||
RUN_AT=2026-03-06T16:46:48Z
|
RUN_AT=2026-03-06T19:14:40Z
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
||||||
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
||||||
RUN_AT=2026-03-06T16:46:49Z
|
RUN_AT=2026-03-06T19:10:55Z
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
||||||
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
||||||
RUN_AT=2026-03-06T16:46:49Z
|
RUN_AT=2026-03-06T19:10:56Z
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
AUTO_GIT_ROOT=/home/openclaw/.openclaw/workspace/helpyourneighbour
|
||||||
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
TASK_TITLE=Run expanded local discovery and continue with next actionable task
|
||||||
RUN_AT=2026-03-06T16:46:47Z
|
RUN_AT=2026-03-06T19:10:54Z
|
||||||
|
|
|
||||||
|
|
@ -1,114 +1,16 @@
|
||||||
# Autonomy Discovery
|
# Autonomy Discovery
|
||||||
|
|
||||||
Generated: 2026-03-06T16:46:49Z
|
Generated: 2026-03-06T19:14:40Z
|
||||||
|
|
||||||
## Git Status
|
## Git Status
|
||||||
?? docs/runtime/agent_state_helpyourneighbour.json
|
M docs/runtime/agent_state_helpyourneighbour.json
|
||||||
?? docs/runtime/autogit_helpyourneighbour_1_autonomy-discovery.log
|
M docs/runtime/autogit_helpyourneighbour_1_autonomy-discovery.log
|
||||||
?? docs/runtime/autogit_helpyourneighbour_1_backlog-project-snapshot.log
|
M docs/runtime/autogit_helpyourneighbour_2_autonomy-discovery.log
|
||||||
?? docs/runtime/autogit_helpyourneighbour_2_autonomy-discovery.log
|
M docs/runtime/autogit_helpyourneighbour_3_autonomy-discovery.log
|
||||||
?? docs/runtime/autogit_helpyourneighbour_2_backlog-goal-brief.log
|
M docs/runtime/autogit_helpyourneighbour_4_autonomy-discovery.log
|
||||||
?? docs/runtime/autogit_helpyourneighbour_2_todo-priority.log
|
M docs/runtime/autonomy_discovery_helpyourneighbour.md
|
||||||
?? docs/runtime/autogit_helpyourneighbour_3_autonomy-discovery.log
|
M docs/runtime/notion_recall_helpyourneighbour.md
|
||||||
?? docs/runtime/autogit_helpyourneighbour_3_backlog-goal-verify.log
|
M docs/runtime/smoke_status_helpyourneighbour.env
|
||||||
?? docs/runtime/autogit_helpyourneighbour_4_autonomy-discovery.log
|
|
||||||
?? docs/runtime/autogit_helpyourneighbour_4_backlog-goal-targets.log
|
|
||||||
?? docs/runtime/autonomy_discovery_helpyourneighbour.md
|
|
||||||
?? docs/runtime/backlog_item_helpyourneighbour.md
|
|
||||||
?? docs/runtime/generated_artifacts_helpyourneighbour.md
|
|
||||||
?? docs/runtime/goal_brief_helpyourneighbour.md
|
|
||||||
?? docs/runtime/goal_targets_helpyourneighbour.md
|
|
||||||
?? docs/runtime/integration_and_playwright_list_helpyourneighbour.log
|
|
||||||
?? docs/runtime/integration_candidates_helpyourneighbour.md
|
|
||||||
?? docs/runtime/integration_context_helpyourneighbour.md
|
|
||||||
?? docs/runtime/integration_recheck_helpyourneighbour.log
|
|
||||||
?? docs/runtime/integration_repair_brief_helpyourneighbour.md
|
|
||||||
?? docs/runtime/integration_status_helpyourneighbour.env
|
|
||||||
?? docs/runtime/integration_targets_helpyourneighbour.md
|
|
||||||
?? docs/runtime/integration_test_helpyourneighbour.log
|
|
||||||
?? docs/runtime/integration_triage_helpyourneighbour.md
|
|
||||||
?? docs/runtime/next_action_playwright_config_helpyourneighbour.md
|
|
||||||
?? docs/runtime/notion_recall_helpyourneighbour.md
|
|
||||||
?? docs/runtime/playwright_config_and_integration_recheck.log
|
|
||||||
?? docs/runtime/playwright_list_helpyourneighbour.log
|
|
||||||
?? docs/runtime/project_snapshot_helpyourneighbour.md
|
|
||||||
?? docs/runtime/smoke_status_helpyourneighbour.env
|
|
||||||
?? docs/runtime/smoke_test_helpyourneighbour.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_autonomy-discovery.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_backlog-goal-brief.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_backlog-inspect.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_backlog-project-snapshot.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_blocked-stall.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-check.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-context-audit.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-failure-blocked.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-repair-brief.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-targets.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_integration-triage.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_no-work.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_project-snapshot.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_working-tree-audit.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_1_working-tree-targets.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_autonomy-discovery.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_backlog-goal-brief.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_backlog-goal-targets.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_blocked-stall.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_generated-artifacts-review.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_integration-candidates.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_integration-failure-blocked.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_no-work.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_todo-priority.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_2_working-tree-targets.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_3_autonomy-discovery.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_3_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_3_blocked-stall.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_4_autonomy-discovery.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_4_backlog-goal-targets.log
|
|
||||||
?? docs/runtime/task_helpyourneighbour_4_blocked-stall.log
|
|
||||||
?? docs/runtime/todo_priority_helpyourneighbour.md
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_autonomy-discovery.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_backlog-goal-brief.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_backlog-inspect.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_backlog-project-snapshot.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_blocked-stall.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_integration-check.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_integration-failure-blocked.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_integration-repair-brief.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_integration-targets.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_integration-triage.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_no-work.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_project-snapshot.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_working-tree-audit.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_1_working-tree-targets.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_autonomy-discovery.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_backlog-goal-brief.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_backlog-goal-targets.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_blocked-stall.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_generated-artifacts-review.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_integration-candidates.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_integration-failure-blocked.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_no-work.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_todo-priority.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_2_working-tree-targets.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_3_autonomy-discovery.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_3_backlog-goal-verify.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_3_blocked-stall.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_3_integration_playwright_check.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_4_autonomy-discovery.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_4_backlog-goal-targets.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_4_blocked-stall.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_4_playwright_integration_check.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_5_playwright_config_and_integration.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_6_playwright_config_and_tests.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_7_integration_and_playwright_list.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_8_integration_and_playwright_list.log
|
|
||||||
?? docs/runtime/verify_helpyourneighbour_9_integration_and_playwright_list.log
|
|
||||||
?? docs/runtime/working_tree_audit_helpyourneighbour.md
|
|
||||||
?? docs/runtime/working_tree_targets_helpyourneighbour.md
|
|
||||||
|
|
||||||
## Candidate Work
|
## Candidate Work
|
||||||
# Working Tree Targets
|
# Working Tree Targets
|
||||||
|
|
@ -169,7 +71,7 @@ docs/runtime/task_helpyourneighbour_1_no-work.log
|
||||||
3 files changed, 42 insertions(+), 12 deletions(-)
|
3 files changed, 42 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
## TODO/FIXME Scan
|
## TODO/FIXME Scan
|
||||||
docs/runtime/autonomy_discovery_helpyourneighbour.md:171:## TODO/FIXME Scan
|
docs/runtime/autonomy_discovery_helpyourneighbour.md:73:## TODO/FIXME Scan
|
||||||
docs/runtime/autogit_helpyourneighbour_2_todo-priority.log:2:TASK_TITLE=Prioritize open TODO/FIXME items
|
docs/runtime/autogit_helpyourneighbour_2_todo-priority.log:2:TASK_TITLE=Prioritize open TODO/FIXME items
|
||||||
docs/runtime/todo_priority_helpyourneighbour.md:1:# TODO/FIXME Priorities (helpyourneighbour)
|
docs/runtime/todo_priority_helpyourneighbour.md:1:# TODO/FIXME Priorities (helpyourneighbour)
|
||||||
docs/runtime/todo_priority_helpyourneighbour.md:3:docs/runtime/autonomy_discovery_helpyourneighbour.md:149:## TODO/FIXME Scan
|
docs/runtime/todo_priority_helpyourneighbour.md:3:docs/runtime/autonomy_discovery_helpyourneighbour.md:149:## TODO/FIXME Scan
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# Notion Recall
|
# Notion Recall
|
||||||
|
|
||||||
Target: KnowledgeBase Openclaw
|
Target: KnowledgeBase Openclaw
|
||||||
Raw query: continue
|
Raw query: Führe jetzt genau einen autonomen Continue-Tick aus (hart auf 45s begrenzt).\nexec AGENT_CONTINUE_SKIP_TESTS=1 timeout 45s /home/openclaw/.openclaw/workspace/bin/agent_continue helpyourneighbour --passes 1\nWenn EXIT=124: gib Tick-Zeitlimit erreicht plus den letzten sinnvollen Fortschritt an.\nWenn EXIT!=0 und !=124: gib den konkreten Blocker inkl. Logfile-Pfad aus.\nWenn EXIT=0: gib eine kurze Einzeilen-Zusammenfassung (Task/Verify/Git).\nCurrent time: Friday, March 6th, 2026 — 19:10 (UTC)
|
||||||
Search query: continue
|
Search query: hre jetzt genau autonomen continue-tick hart
|
||||||
Status: ok
|
Status: ok
|
||||||
|
|
||||||
## Root
|
## Root
|
||||||
|
|
@ -11,4 +11,5 @@ Status: ok
|
||||||
- URL: https://www.notion.so/Dein-Wissen-e11b60a0ded88391abf2012a4c75cc5e
|
- URL: https://www.notion.so/Dein-Wissen-e11b60a0ded88391abf2012a4c75cc5e
|
||||||
|
|
||||||
## Results
|
## Results
|
||||||
- none
|
- OpenClaw Knowledge | helpyourneighbour | hre jetzt genau autonomen continue lauf nexec [page] https://www.notion.so/OpenClaw-Knowledge-helpyourneighbour-hre-jetzt-genau-autonomen-continue-lauf-nexec-31bb60a0ded88111aef2cf5168f01bc3
|
||||||
|
- OpenClaw Knowledge | helpyourneighbour | continue [page] https://www.notion.so/OpenClaw-Knowledge-helpyourneighbour-continue-31bb60a0ded881588e15cd53ed5e08ac
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
EXIT=0
|
EXIT=0
|
||||||
RUN_AT=2026-03-06T16:46:50Z
|
RUN_AT=2026-03-06T19:18:10Z
|
||||||
LOGFILE=/home/openclaw/.openclaw/workspace/helpyourneighbour/docs/runtime/smoke_test_helpyourneighbour.log
|
LOGFILE=
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue