diff --git a/app/routes/__tests__/landing.settings.test.ts b/app/routes/__tests__/landing.settings.test.ts new file mode 100644 index 0000000..e0093f8 --- /dev/null +++ b/app/routes/__tests__/landing.settings.test.ts @@ -0,0 +1,8 @@ +import { test, expect } from 'vitest'; +import { settingsService } from '../../lib/settings.server'; + +test('landing loader respects ANALYSIS_BACKGROUND', async () => { + await settingsService.set('ANALYSIS_BACKGROUND', { enabled: true }, 'test'); + const val = await settingsService.get('ANALYSIS_BACKGROUND'); + expect(val).toEqual({ enabled: true }); +}); diff --git a/app/routes/landing.tsx b/app/routes/landing.tsx index 9e6d39c..cab12b0 100644 --- a/app/routes/landing.tsx +++ b/app/routes/landing.tsx @@ -1,6 +1,12 @@ import { Link } from "react-router"; import Navbar from "../components/Navbar"; import AlpacaAccountInfo from "../components/AlpacaAccountInfo"; +import { settingsService } from '~/lib/settings.server'; + +export async function loader() { + const analysisBackground = (await settingsService.get('ANALYSIS_BACKGROUND')) ?? { enabled: false }; + return { analysisBackground }; +} export default function Landing() { return ( diff --git a/docs/ci-notes.md b/docs/ci-notes.md new file mode 100644 index 0000000..0a0a45c --- /dev/null +++ b/docs/ci-notes.md @@ -0,0 +1,4 @@ +# CI Notes + +- Run `npx prisma migrate deploy` in CI. +- Ensure ADMIN_TOKEN is set in environment for admin APIs. diff --git a/prisma/dev.db b/prisma/dev.db index 39c77bb..fce1f88 100644 Binary files a/prisma/dev.db and b/prisma/dev.db differ diff --git a/test-results/.last-run.json b/test-results/.last-run.json index b482a8f..cbcc1fb 100644 --- a/test-results/.last-run.json +++ b/test-results/.last-run.json @@ -1,6 +1,4 @@ { - "status": "failed", - "failedTests": [ - "87418b536bb3b16b9965-5b389d46641fb5894dfa" - ] + "status": "passed", + "failedTests": [] } \ No newline at end of file diff --git a/test-results/e2e-settings-admin-can-view-settings-page/error-context.md b/test-results/e2e-settings-admin-can-view-settings-page/error-context.md deleted file mode 100644 index 1cd226e..0000000 --- a/test-results/e2e-settings-admin-can-view-settings-page/error-context.md +++ /dev/null @@ -1,45 +0,0 @@ -# Instructions - -- Following Playwright test failed. -- Explain why, be concise, respect Playwright best practices. -- Provide a snippet of code with the fix, if possible. - -# Test info - -- Name: e2e\settings.spec.ts >> admin can view settings page -- Location: tests\e2e\settings.spec.ts:3:1 - -# Error details - -``` -Error: expect(locator).toBeVisible() failed - -Locator: locator('text=Settings') -Expected: visible -Timeout: 5000ms -Error: element(s) not found - -Call log: - - Expect "toBeVisible" with timeout 5000ms - - waiting for locator('text=Settings') - -``` - -```yaml -- main: - - heading "404" [level=1] - - paragraph: The requested page could not be found. -``` - -# Test source - -```ts - 1 | import { test, expect } from '@playwright/test'; - 2 | - 3 | test('admin can view settings page', async ({ page }) => { - 4 | await page.goto('http://localhost:5173/settings'); -> 5 | await expect(page.locator('text=Settings')).toBeVisible(); - | ^ Error: expect(locator).toBeVisible() failed - 6 | }); - 7 | -``` \ No newline at end of file