mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
We change the user facing interface to allow specifying expected
number of error messages (default=1). Now an average test can look
like:
```
// We expect 3 error messages;
blueslip.expect('error', 'an error message', 3);
throwError();
throwError();
throwError();
blueslip.reset();
```
24 lines
530 B
JavaScript
24 lines
530 B
JavaScript
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', 2);
|
|
const ls = new LazySet([1, 2]);
|
|
ls.add('3');
|
|
assert(ls.has('3'));
|
|
blueslip.reset();
|
|
});
|