5180 fichiers 38.5 Mo 0 téléchargements 250 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / hooks / navigator / adoptsEnteredRoom.test.ts
adoptsEnteredRoom.test.ts 867 o Télécharger le fichier
/* @vitest-environment jsdom */
import { describe, expect, it } from 'vitest';
import { adoptsEnteredRoom } from './useNavigatorStore';

/**
 * The server answers roomEnter for any GetGuestRoom request that is not exactly
 * (roomId, false, true), so an answer about another room used to point room info,
 * settings, the word filter and favourites at a room the user is not in.
 */
describe('adoptsEnteredRoom', () => {
    it('takes the answer for the room we are in', () => {
        expect(adoptsEnteredRoom(12, 12)).toBe(true);
    });

    it('ignores an answer about another room', () => {
        expect(adoptsEnteredRoom(12, 99)).toBe(false);
    });

    it('takes the first answer when no room is current yet', () => {
        // Entering a room: RoomEntryInfo has not set currentRoomId yet.
        expect(adoptsEnteredRoom(0, 99)).toBe(true);
    });
});
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser