Commit graph naco-api/internal/store/integration_test.go
Author SHA1 Message Date
5cd1d128d6
test: expand Ollama client tests and store integration coverage 2026-09-08 01:25:44 +00:00
ee0589c774 chore: tidy store integration test and deps
- remove tautological SaveTransaction SQL/Params constant checks (const string replay)
- go.mod tidy drops unused go-sqlmock indirect
- testClient/main.go: gofmt alignment
2026-09-03 17:00:45 +00:00
5574a8596f db: update embedding dimension to 1024 for qwen3-embedding:0.6b
- Migration 002: VECTOR(768) -> VECTOR(1024) to match qwen3-embedding:0.6b default output
- integration_test.go: update test vector from 768 to 1024 dimensions
2026-09-02 00:00:10 +02:00
114574b331 Complete transaction save test suite
- TestSettleHook (internal/server/mcp_test.go): verifies SaveTransactionParams field mapping
  - Tests all 6 params: X402TransactionHash, Amount, Asset, Network, Recipient, Sender
  - Ensures params are settable without panic, critical for legal compliance of x402 flow

- TestStoreSaveTransaction (internal/store/integration_test.go): integration test against real Postgres
  - Exercised SaveTransaction query end-to-end with full param mapping
  - Skipped without TEST_DATABASE_URL (same pattern as TestStoreRoundTrip)
  - Verifies: insert returns ID and CreatedAt, ID is positive, CreatedAt is valid
  - Uses unique transaction hash per test run via time.Now().Unix()

Both tests ensure the critical transaction-saving mechanism is verified at both unit and integration levels, providing regression protection for the legal-compliance x402 payment flow.
2026-08-31 00:01:29 +02:00
fbd1f5af6c Add SaveTransaction SQL and params tests
- TestSaveTransactionSQL: verifies the sqlc-generated SaveTransaction query constant matches the source SQL file
- TestSaveTransactionParams: verifies SaveTransactionParams struct can be constructed with valid and edge-case values (empty hash, empty amount)

Both tests are pure-unit tests that don't require a database connection. They ensure the critical transaction-saving SQL query and its parameter mapping remain consistent, which is important for legal compliance of the x402 payment flow.
2026-08-30 23:56:40 +02:00
d7bece250f Use named parameters in SQL queries to avoid ColumnN naming in sqlc generated structs
- Rewrite GetStyleProfile, FindSimilarUsers, UpsertStyleProfiles SQL queries
  to use @named parameters instead of  positional placeholders
- Regenerate sqlc Go files with meaningful parameter names
- Update server.go and integration test to use new parameter field names
- Fix Similarity int32→float64 type conversion
2026-08-30 22:41:53 +02:00
4ac15ff6c2 test: cover getActor/searchActors clients and migrations
Runnable (HTTP-mocked) unit tests:
- activitypub: GetActor (accounts/lookup) plus id-lookup fallback, and SearchActors
  (accounts/search).
- twitter: GetActor (/users/by/username) and SearchActors (/users/search).
- nostr: SearchActors best-effort path (non-resolvable query returns empty, no network).
- store: extractUpSQL parsing helper.

Store integration test (TestStoreRoundTrip) is gated behind TEST_DATABASE_URL and skipped
when no Postgres+pgvector is available; it runs Migrate and exercises the Upsert/Get/
FindSimilarUsers round-trip against a real database.

Co-Authored-By: Claude (AI assistant) <noreply@anthropic.com>
2026-08-29 02:16:39 +02:00