5180 fichiers 38.5 Mo 0 téléchargements 272 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / api / octane / session / IsPlayTestRestricted.test.ts
IsPlayTestRestricted.test.ts 1.2 Ko Télécharger le fichier
import { GetRoomEngine, IRoomSession } from '@octane/renderer';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { IsPlayTestRestricted } from './IsPlayTestRestricted';

const withRoomEngine = (freeFurniMovements: boolean) =>
    vi.mocked(GetRoomEngine).mockReturnValue({
        activeRoomHasFreeFurniMovementsMode: freeFurniMovements
    } as unknown as ReturnType<typeof GetRoomEngine>);

const owner = (playTestMode: boolean) => ({ roomId: 1, isRoomOwner: true, controllerLevel: 0, playTestMode }) as IRoomSession;

describe('IsPlayTestRestricted (the hotel playtest building rule)', () => {
    afterEach(() => vi.mocked(GetRoomEngine).mockReset());

    it('restricts the room owner while playtest is on', () => {
        withRoomEngine(false);

        expect(IsPlayTestRestricted(owner(true))).toBe(true);
    });

    it('leaves normal play alone', () => {
        withRoomEngine(false);

        expect(IsPlayTestRestricted(owner(false))).toBe(false);
        expect(IsPlayTestRestricted(null)).toBe(false);
    });

    it('is lifted by the free furni movements mode, as on the server', () => {
        withRoomEngine(true);

        expect(IsPlayTestRestricted(owner(true))).toBe(false);
    });
});
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