concat.js 775 B

123456789101112131415161718192021222324252627282930
  1. import assert from 'assert';
  2. describe('concat', () => {
  3. it('concatenates the supplied Observable arguments', async () => {
  4. let list = [];
  5. await Observable
  6. .from([1, 2, 3, 4])
  7. .concat(Observable.of(5, 6, 7))
  8. .forEach(x => list.push(x));
  9. assert.deepEqual(list, [1, 2, 3, 4, 5, 6, 7]);
  10. });
  11. it('can be used multiple times to produce the same results', async () => {
  12. const list1 = [];
  13. const list2 = [];
  14. const concatenated = Observable.from([1, 2, 3, 4])
  15. .concat(Observable.of(5, 6, 7));
  16. await concatenated
  17. .forEach(x => list1.push(x));
  18. await concatenated
  19. .forEach(x => list2.push(x));
  20. assert.deepEqual(list1, [1, 2, 3, 4, 5, 6, 7]);
  21. assert.deepEqual(list2, [1, 2, 3, 4, 5, 6, 7]);
  22. });
  23. });