5180 fichiers 38.5 Mo 0 téléchargements 238 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / api / inventory / FurnitureSection.test.ts
FurnitureSection.test.ts 978 o Télécharger le fichier
/* @vitest-environment jsdom */
import { describe, expect, it } from 'vitest';
import { inFurnitureSection } from './FurnitureFilter';
import { GroupItem } from './GroupItem';

const make = (over: { rentable?: boolean; uniqueNumber?: number }) =>
    ({ getLastItem: () => ({ rentable: !!over.rentable, stuffData: { uniqueNumber: over.uniqueNumber ?? 0 } }) }) as unknown as GroupItem;

describe('inFurnitureSection', () => {
    const plain = make({});
    const numbered = make({ uniqueNumber: 5 });
    const rented = make({ rentable: true });
    const rentedNumbered = make({ rentable: true, uniqueNumber: 3 });
    const all = [plain, numbered, rented, rentedNumbered];

    it('keeps each item in exactly one section', () => {
        expect(inFurnitureSection(all, 'furni')).toEqual([plain]);
        expect(inFurnitureSection(all, 'collectibles')).toEqual([numbered]);
        expect(inFurnitureSection(all, 'rentables')).toEqual([rented, rentedNumbered]);
    });
});
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