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 / components / wired / views / WiredVariablePickSource.test.ts
WiredVariablePickSource.test.ts 1 Ko Télécharger le fichier
import { describe, expect, it } from 'vitest';
import { toEditorPickSource, toWirePickSource } from './WiredVariablePickSource';

const withConf = (furniAllowed: number[][]) => ({ inputSourcesConf: { furniAllowed, userAllowed: [], furniDefaults: [], userDefaults: [] } }) as never;

describe('variable reference pick source', () => {
    it('reads a stored 101 as the picks', () => {
        expect(toEditorPickSource(101)).toBe(100);
        expect(toEditorPickSource(100)).toBe(100);
        expect(toEditorPickSource(200)).toBe(200);
    });

    it('sends the picks as 100 once the server lists it', () => {
        expect(toWirePickSource(withConf([[0, 100, 101, 200, 201]]), 100)).toBe(100);
    });

    it('keeps 101 for a server without the row', () => {
        expect(toWirePickSource(withConf([]), 100)).toBe(101);
        expect(toWirePickSource(null, 100)).toBe(101);
    });

    it('leaves other sources alone', () => {
        expect(toWirePickSource(null, 0)).toBe(0);
        expect(toWirePickSource(null, 201)).toBe(201);
    });
});
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