UNPKG

geninq

Version:

A JavaScript version of the Linq library for Generators

42 lines (39 loc) 780 B
import "./dictionary"; import { It } from "../test-utils"; It("Creates a basic dictionary", (s) => s.dictionary((i) => i), { 1: 1, 2: 2, 3: 3, }); It( "Creates a dictionary from complex objects", (s) => s.dictionary((i) => i.key), { test1: { key: "test1", value: 3 }, test2: { key: "test2", value: 2 }, test3: { key: "test3", value: 1 }, }, [ { key: "test1", value: 3 }, { key: "test2", value: 2 }, { key: "test3", value: 1 }, ] ); It( "Creates a dictionary from complex objects with value selector", (s) => s.dictionary( (i) => i.key, (i) => i.value ), { test1: 3, test2: 2, test3: 1, }, [ { key: "test1", value: 3 }, { key: "test2", value: 2 }, { key: "test3", value: 1 }, ] );