Ratatoskr/src/app/hooks/useClientConfig.test.ts
Void 764ee441bd
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 3m44s
auth: the register entry takes https only, http only for a local host (Heimdall)
registrationEntry accepts an https url, or http when the host is localhost, *.localhost, 127.0.0.1 or ::1. A test pins both sides, including a look-alike host. The two tests that pass config.json as a ClientConfig now cast it, so tsc is clean for them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:31:26 +00:00

20 lines
752 B
TypeScript

import { describe, expect, it } from 'vitest';
import { ClientConfig, clientDefaultServer } from './useClientConfig';
import config from '../../../config.json';
describe('default homeserver', () => {
it('is gamecult.org when the config names none', () => {
expect(clientDefaultServer({})).toBe('gamecult.org');
expect(clientDefaultServer({ homeserverList: [] })).toBe('gamecult.org');
});
it('is the listed server the config points at', () => {
expect(
clientDefaultServer({ homeserverList: ['chat.gamecult.org'], defaultHomeserver: 0 })
).toBe('chat.gamecult.org');
});
it('is gamecult.org in the repo config.json too', () => {
expect(clientDefaultServer(config as ClientConfig)).toBe('gamecult.org');
});
});