Add share pin
This commit is contained in:
parent
3e9a988748
commit
1078ece85c
5 changed files with 318 additions and 5 deletions
|
|
@ -1279,6 +1279,51 @@ describe('OAuth Callback Handling', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('/play/:pin URL Join Flow', () => {
|
||||
describe('Landing PIN sync (regression: PIN field empty on /play/:pin)', () => {
|
||||
it('should sync local PIN state when initialPin prop changes after async load', () => {
|
||||
let initialPin: string | null = null;
|
||||
let localPin = initialPin || '';
|
||||
|
||||
const syncPin = (newInitialPin: string | null) => {
|
||||
if (newInitialPin) {
|
||||
localPin = newInitialPin;
|
||||
}
|
||||
};
|
||||
|
||||
initialPin = 'TESTPIN';
|
||||
syncPin(initialPin);
|
||||
|
||||
expect(localPin).toBe('TESTPIN');
|
||||
});
|
||||
|
||||
it('should preserve user-typed PIN when initialPin becomes null', () => {
|
||||
let localPin = 'USER_TYPED';
|
||||
|
||||
const syncPin = (newInitialPin: string | null) => {
|
||||
if (newInitialPin) {
|
||||
localPin = newInitialPin;
|
||||
}
|
||||
};
|
||||
|
||||
syncPin(null);
|
||||
|
||||
expect(localPin).toBe('USER_TYPED');
|
||||
});
|
||||
|
||||
it('should force JOIN mode when initialPin is provided via URL', () => {
|
||||
const getModeFromUrl = (searchParams: URLSearchParams, initialPin?: string): 'HOST' | 'JOIN' => {
|
||||
if (initialPin) return 'JOIN';
|
||||
const modeParam = searchParams.get('mode');
|
||||
return modeParam === 'host' ? 'HOST' : 'JOIN';
|
||||
};
|
||||
|
||||
const searchParams = new URLSearchParams('?mode=host');
|
||||
expect(getModeFromUrl(searchParams, 'TESTPIN')).toBe('JOIN');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('State Sync with Async Data Loading', () => {
|
||||
describe('Settings modal data sync', () => {
|
||||
it('should update editingDefaultConfig when defaultConfig loads', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue