Coder Social home page Coder Social logo

Comments (2)

kwonoj avatar kwonoj commented on June 19, 2024

I don't think you can do this out of box, looks like you'd like to resolve marble to key but currently always falls to value to draw marbles. Main design comes due to key for marble observable is arbitrary value, actual value we care about is value itself (if key === value that doesn't matter though). Not sure if I'll spend time to create additional path for this logic.

from rx-sandbox.

sharikovvladislav avatar sharikovvladislav commented on June 19, 2024

Main design comes due to key for marble observable is arbitrary value, actual value we care about is value itself (if key === value that doesn't matter though)

Thats perfect. But at the moment if you put null/undefined to the observable , you will get some stuff like ä as the output. Yeah, okay, and what is ä? What are other symbols? You don't know it at all from the output. Just debug.

Okay, so now the library works perfectly only with numbers and values which are 1-literal strings.

The test:

it('testcase', () => {
  const {hot, e, s, getMessages, flush} = rxSandbox.create();


  const values = { a: undefined };
  const source = hot('aaaaaaaaa|', values);
  const expected = e('---x--yf---|', values);
  
  const messages = getMessages(source.pipe(mapTo(undefined)));
  flush();

  marbleAssert(messages).to.equal(expected);
});

Output:

        Error: 
        "Source:   äḅċḋëḟġḧï|"
        "Expected: ---x--yf---|"

It is simple observable which emits undefined N times. Cool. And we got äḅċḋëḟġḧï| as output. Well, that makes sense. Developer experience.

Main design comes...

Values in the observables in test are not random. You write test, you pass test data, you know what values you will pass and what values are expected. That is how unit testing works.
Even some kind of fn as value can be passed, when you will determine symbol based on some logic (complex objects, you can use type guards).

from rx-sandbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.