Remove all references to legacy RUNTIME_SEED_* environment variables from documentation and codebase. Update docs and .env.example to document the new RUNTIME_SEED_JSON and RUNTIME_SEED_JSON_PATH variables for first-boot runtime config and provider seeding. Refactor admin seed logic and runtime config schema to eliminate env-var-based seeding in favor of JSON-based initialization. Update admin panel UI and badges to reflect new seed sources. Remove obsolete env parsing logic and tests for RUNTIME_SEED_* flags. Add new tests for JSON seed behavior. BREAKING CHANGE: RUNTIME_SEED_* environment variables are no longer supported; use RUNTIME_SEED_JSON or RUNTIME_SEED_JSON_PATH for first-boot runtime config and provider seeding.
26 lines
1 KiB
TypeScript
26 lines
1 KiB
TypeScript
import { describe, expect, test } from 'vitest';
|
|
|
|
import { RUNTIME_CONFIG_SCHEMA } from '../../src/lib/server/admin/settings';
|
|
import { assertUserSignupAllowed } from '../../src/lib/server/auth/signup-policy';
|
|
|
|
describe('enableUserSignups runtime config', () => {
|
|
test('defaults to enabled', () => {
|
|
expect(RUNTIME_CONFIG_SCHEMA.enableUserSignups.default).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('signup policy enforcement', () => {
|
|
test('allows new non-anonymous users when signups are enabled', () => {
|
|
expect(() => assertUserSignupAllowed({ enableUserSignups: true, isAnonymous: false })).not.toThrow();
|
|
});
|
|
|
|
test('blocks new non-anonymous users when signups are disabled', () => {
|
|
expect(() => assertUserSignupAllowed({ enableUserSignups: false, isAnonymous: false })).toThrow(
|
|
/sign-ups are disabled/i,
|
|
);
|
|
});
|
|
|
|
test('does not block anonymous-session user creation when signups are disabled', () => {
|
|
expect(() => assertUserSignupAllowed({ enableUserSignups: false, isAnonymous: true })).not.toThrow();
|
|
});
|
|
});
|