feat(settings): link the Steam account through Steam
Build, Test & Push Frontend / quality-check (push) Successful in 16s
Build, Test & Push Frontend / docker (push) Successful in 25s

A Steam card in the settings links, verifies or unlinks the Steam
account through "Sign in through Steam". After the way back the page
shows the outcome and refreshes the session, so Core gets the new
Steam ID at once. Registration and settings no longer ask for a typed
Steam ID.
This commit is contained in:
lobo committed 2026-09-26 11:20:04 +02:00
1 parent 23ab5a91e7
commit ca75e6a530
13 files changed
+393 -86

No files matched your search

+8 -24
View File
@@ -1,36 +1,20 @@
import {describe, expect, it} from 'vitest';
import {registrationSchema, settingsSchema} from './validation.js';
const settings = (steamId) => ({useDarkTheme: true, language: 'de', steamId});
const settings = () => ({useDarkTheme: true, language: 'de'});
describe('steamId validation', () => {
it('keeps a SteamID64 as the exact string', () => {
// Number('76561198005679788') is 76561198005679790
expect(settingsSchema.parse(settings('76561198005679788')).steamId).toBe('76561198005679788');
});
it('trims whitespace', () => {
expect(settingsSchema.parse(settings(' 76561198005679788 ')).steamId).toBe('76561198005679788');
});
it.each(['', '12345', '7656119800567978x', '765611980056797880'])('rejects %j', (steamId) => {
expect(settingsSchema.safeParse(settings(steamId)).success).toBe(false);
});
it('keeps the exact string on registration', () => {
const result = registrationSchema.parse({
email: 'a@b.de',
password: 'password1',
passwordConfirmation: 'password1',
inviteCode: 'code',
describe('Steam ID', () => {
it('is no form field any more: it comes only from "Sign in through Steam"', () => {
expect(settingsSchema.parse({...settings(), steamId: '76561198005679788'})).not.toHaveProperty('steamId');
expect(registrationSchema.parse({
email: 'a@b.de', password: 'password1', passwordConfirmation: 'password1', inviteCode: 'code',
steamId: '76561198005679788',
});
expect(result.steamId).toBe('76561198005679788');
})).not.toHaveProperty('steamId');
});
});
describe('displayName validation', () => {
const withName = (displayName) => ({...settings('76561198005679788'), displayName});
const withName = (displayName) => ({...settings(), displayName});
it('turns an empty field into null (no display name)', () => {
expect(settingsSchema.parse(withName(' ')).displayName).toBeNull();