From a965af4d46b6f941a59cd4608f86d4f7b7e5114f Mon Sep 17 00:00:00 2001 From: yanweidong Date: Sat, 18 Jul 2026 16:53:47 +0800 Subject: [PATCH] test: add postgres integration verification --- apps/web/README.md | 36 +++++-------------- .../internal/db/postgres_integration_test.go | 21 +++++++++++ docs/mvp-verification.md | 10 ++++++ 3 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 backend/internal/db/postgres_integration_test.go diff --git a/apps/web/README.md b/apps/web/README.md index d6af7e3..5e6fab9 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -1,32 +1,14 @@ -# React + TypeScript + Vite +# SenlinAI Web -This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules. +Svelte + TypeScript web client for the project workbench. -Currently, two official plugins are available: +## Scripts -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) - -## React Compiler - -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). - -## Expanding the Oxlint configuration - -If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`: - -```json -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["react", "typescript", "oxc"], - "options": { - "typeAware": true - }, - "rules": { - "react/rules-of-hooks": "error", - "react/only-export-components": ["warn", { "allowConstantExport": true }] - } -} +```powershell +npm run dev +npm test -- --run +npm run build +npx playwright test ``` -See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories. +The login shell lets users enter the server IP address or domain name used as the API base URL. diff --git a/backend/internal/db/postgres_integration_test.go b/backend/internal/db/postgres_integration_test.go new file mode 100644 index 0000000..63f0429 --- /dev/null +++ b/backend/internal/db/postgres_integration_test.go @@ -0,0 +1,21 @@ +//go:build integration + +package db + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestPostgresPing(t *testing.T) { + databaseURL := os.Getenv("DATABASE_URL") + require.NotEmpty(t, databaseURL, "DATABASE_URL is required for integration tests") + + database, err := Open(databaseURL) + require.NoError(t, err) + sqlDB, err := database.DB() + require.NoError(t, err) + require.NoError(t, sqlDB.Ping()) +} diff --git a/docs/mvp-verification.md b/docs/mvp-verification.md index fde62fb..ce99e8c 100644 --- a/docs/mvp-verification.md +++ b/docs/mvp-verification.md @@ -21,6 +21,16 @@ postgres://postgres:Weidong2023~!@8.137.107.29:19432/agent_dev?sslmode=disable Do not hardcode this value into application source files. Pass it through `DATABASE_URL`. +Run: + +```powershell +Set-Location backend +$env:DATABASE_URL='postgres://postgres:Weidong2023~!@8.137.107.29:19432/agent_dev?sslmode=disable' +go test -tags integration ./internal/db -run TestPostgresPing -v +``` + +Expected: `TestPostgresPing` passes. + ## Web The frontend is Svelte-only.