Skip to content

Instantly share code, notes, and snippets.

@GerritRiesch94
Last active March 3, 2022 10:12
Show Gist options
  • Save GerritRiesch94/a3db36126cf1bbccdb9a871297194d9b to your computer and use it in GitHub Desktop.
Save GerritRiesch94/a3db36126cf1bbccdb9a871297194d9b to your computer and use it in GitHub Desktop.
import {extractIdsOfSolvedCases} from './rxjs-operators';
import {marbles} from 'rxjs-marbles';
import {Report} from './reports.service';
describe('rxjs-operators', () => {
describe('extractIdsOfSolvedCases', () => {
it('should extract all ids of solved cases', marbles((context) => {
const source = context.cold('abc|', {
a: {id: 1, case: {id: 'The Pontiac Bandit'}, detectives: [], solved: false } as Report,
b: {id: 2, case: {id: 'The Disco Strangler'}, detectives: [], solved: true } as Report,
c: {id: 3, case: {id: 'Maximum Security'}, detectives: [], solved: true } as Report,
})
const destination = source.pipe(
extractIdsOfSolvedCases()
);
context.expect(destination).toBeObservable('---(d|)', {
d: [2, 3]
})
}));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment