5180 fichiers 38.5 Mo 0 téléchargements 275 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / api / room / widgets / AvatarMenuOptions.test.ts
AvatarMenuOptions.test.ts 1.7 Ko Télécharger le fichier
import { describe, expect, it } from 'vitest';
import { AvatarInfoUser } from './AvatarInfoUser';
import { AMBASSADOR_MUTE_MINUTES, canReplenishRespect, getMuteLabelKey, getTradeBlockedKey, shouldShowTrade } from './AvatarMenuOptions';

describe('AvatarMenuOptions', () => {
    it('labels every ambassador mute with an existing text key', () => {
        expect(AMBASSADOR_MUTE_MINUTES.map(getMuteLabelKey)).toEqual([
            'infostand.button.mute_15min',
            'infostand.button.mute_60min',
            'infostand.button.mute_18hour',
            'infostand.button.mute_36hour',
            'infostand.button.mute_72hour'
        ]);
    });

    it('explains why trading is off', () => {
        expect(getTradeBlockedKey(true, AvatarInfoUser.TRADE_REASON_NO_TRADING)).toBeNull();
        expect(getTradeBlockedKey(false, AvatarInfoUser.TRADE_REASON_SHUTDOWN)).toBe('infostand.button.trade.tooltip.shutdown');
        expect(getTradeBlockedKey(false, AvatarInfoUser.TRADE_REASON_NO_TRADING)).toBe('infostand.button.trade.tooltip.tradingroom');
    });

    it('shows trade with the citizenship track on, else only when it is possible with an unblocked user', () => {
        expect(shouldShowTrade(false, false, true)).toBe(true);
        expect(shouldShowTrade(true, true, true)).toBe(true);
        expect(shouldShowTrade(true, false, false)).toBe(true);
        expect(shouldShowTrade(false, false, false)).toBe(false);
        expect(shouldShowTrade(true, true, false)).toBe(false);
    });

    it('offers a replenish only when respects are gone and one is left', () => {
        expect(canReplenishRespect(0, 1)).toBe(true);
        expect(canReplenishRespect(1, 1)).toBe(false);
        expect(canReplenishRespect(0, 0)).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