kwonoj/rx-sandbox

Hello world not working

thiagoarrais opened this issue · 2 comments

I'm trying to run the first code sample from the README with no success. I keep getting "e1.merge is not a function".

I've put together a minimum project here: https://github.com/thiagoarrais/rx-sandbox-helloworld

You should be able to reproduce by git cloning and then npm testing.

I'm using node 6 and npm 5. Here's what I'm getting on my side:

$ node -v
v6.11.2
$ npm -v
5.3.0
$ npm install
npm WARN rx-sandbox-helloworld@1.0.0 No description
npm WARN rx-sandbox-helloworld@1.0.0 No repository field.

added 100 packages in 6.924s
$ npm test

> rx-sandbox-helloworld@1.0.0 test /tmp/rx-sandbox-helloworld
> mocha spec.js



  1) testcase

  0 passing (39ms)
  1 failing

  1)  testcase:
     TypeError: e1.merge is not a function
      at Context.it (spec.js:12:35)



npm ERR! Test failed.  See above for more details.

Maybe cold doesn't return an Observable any longer? I don't know... I'm completely lost lost here...

Example in current documentation is just illustration of interfaces, as it's written based on assumption of user already familiar to setting up importing Rx and others. so the error itself comes from https://github.com/ReactiveX/rxjs#es6-via-npm, by missing operator import - can be resolved as such

const rxSandbox = require('./src/index').rxSandbox;
require('rxjs/add/operator/merge')

const { hot, cold, flush, getMessages, e, s } = rxSandbox.create();
const e1 = hot('  --^--a--b--|');
const e2 = cold('   ---x--y--|', {x: 1, y: 2});

const expected = e('       ---q--r--|');
const sub =      s('       ^        !');

const messages = getMessages(e1.merge(e2));

flush();

and more importantly, test will still fail cause diagram isn't correct assertion for merge operator. so it is actually

expect(messages).to.not.deep.equal(expected);

.

I need to brush up on my rxjs then.

Thanks!