Skip to content

Instantly share code, notes, and snippets.

@gilesbradshaw
Last active January 3, 2018 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilesbradshaw/ab6d75f75cf9d90ce9e7a25a8112831d to your computer and use it in GitHub Desktop.
Save gilesbradshaw/ab6d75f75cf9d90ce9e7a25a8112831d to your computer and use it in GitHub Desktop.
import { marbles } from 'rxjs-marbles';
/* eslint-env mocha */
/* eslint-disable no-unused-expressions */
describe('merge scan', () => {
it(
'should work',
marbles(
(m) => {
m.expect(
m.cold('1234')
.mergeScan(
(acc, val) => m.cold(
'1-2|',
{
1: `${acc}${val}`,
2: `${acc}${val}!`,
}),
'+',
1,
),
).toBeObservable(
'1-23-45-67-8',
{
1: '+1',
2: '+1!',
3: '+1!2',
4: '+1!2!',
5: '+1!2!3',
6: '+1!2!3!',
7: '+1!2!3!4',
8: '+1!2!3!4!',
},
);
},
),
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment