Files
zulip/frontend_tests/node_tests/lazy_set.js
Steve Howell df84c52a7f zblueslip: Change API to expect/reset.
The `set_test_data` never made complete sense to
me, since it wasn't really data that we were
setting.
2020-04-03 12:56:49 -04:00

24 lines
554 B
JavaScript

set_global('blueslip', global.make_zblueslip());
const LazySet = zrequire('lazy_set').LazySet;
/*
We mostly test LazySet indirectly. This code
may be short-lived, anyway, once we change
how we download subscribers in page_params.
*/
run_test('map', () => {
const ls = new LazySet([1, 2]);
const triple = (n) => n * 3;
assert.deepEqual(ls.map(triple), [3, 6]);
});
run_test('conversions', () => {
blueslip.expect('error', 'not a number');
const ls = new LazySet([1, 2]);
ls.add('3');
assert(ls.has('3'));
});