How to use the most.empty function in most

To help you get started, we’ve selected a few most examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github izaakschroeder / afflux / test / spec / combinators / pipeline.spec.js View on Github external
it('should return a stream', () => {
		const result = pipeline(() => { }, empty());
		expect(result).to.have.property('source');
	});
});
github motorcyclejs / collection / test / test-diff.js View on Github external
it('should include an array of changed sinks if one or more sinks changed', () => {
        const list1 = Collection()
          .setInstance('a', {x: most.empty()})
          .setInstance('b', {x: most.empty()})
          .setInstance('c', {y: most.empty()});
        const list2 = list1
          .setInstance('c', {z: most.just(1)})
          .setInstance('d', {z: most.empty()})
          .remove('a', {p: most.empty()});
        const {changed} = calculateDiff(null, list1, list2);
        assert(!changed.get('b').sinks);
        const sinks = changed.get('c').sinks;
        assert(Array.isArray(sinks));
        assert(sinks.length === 2);
        assert(sinks.findIndex(([key, sinks]) => key === 'y' && !sinks) !== -1);
        assert(sinks.findIndex(([key, sinks]) => key === 'z' && isStream(sinks)) !== -1);
      });
    });
github mostjs-community / most-test / test / run.js View on Github external
it('should return a promise', () => {
          const stream = most.empty();
          const env = run(stream);
          const result = env.tick();
          assert.ok(result);
          assert.ok('then' in result);
          assert.equal(typeof result.then, 'function');
        });
github motorcyclejs / collection / test / test-diff.js View on Github external
it('should list only items that are common to both lists', () => {
        const list1 = Collection()
          .setInstance('a', {x: most.empty()})
          .setInstance('b', {x: most.empty()})
          .setInstance('c', {y: most.empty()});
        const list2 = list1
          .setInstance('c', {z: most.just(1)})
          .setInstance('d', {z: most.empty()})
          .remove('a', {p: most.empty()});
        const {changed} = calculateDiff(null, list1, list2);
        assert(changed.size === 2);
        assert(changed.has('b'));
        assert(changed.has('c'));
      });
github motorcyclejs / collection / test / test-set.js View on Github external
it('should replace the existing item if the specified key already exists', () => {
      const list1 = emptyList.set('firstItem', {}).set('secondItem', {});
      assert(!('next' in list1.state.getIn(['items', 'firstItem'], {sinks:{}}).sinks));
      
      const list2 = list1.set('firstItem', {next: most.empty()});
      assert(list2.state.get('items').size === 2);
      assert('next' in list2.state.getIn(['items', 'firstItem'], {sinks:{}}).sinks);
    });
github motorcyclejs / collection / test / test-merge.js View on Github external
it('should end when the list stream ends', () => {
      const bar$ = Collection.merge('bar', most.empty());
      const env = run(bar$);
      return env.tick(1)
        .then(result => {
          assert(result.end);
        });
    });
github motorcyclejs / collection / test / test-diff.js View on Github external
describe('when only the set of sinks differs', () => {
      const last = {index: 7, sinks: {a: most.empty(), b: most.just(1)}};
      const next = {index: 7, sinks: {a: last.sinks.a, b: most.just(2)}};
      function run() {
        return compareItems(null, last, next);
      }

      it('should exclude the new index', () => {
        assert(!('index' in run()));
      });

      it('should include the sinks comparison', () => {
        assert.deepEqual(run(), {sinks: [['b', next.sinks.b]]});
      });
    });
github FormidableLabs / rapscallion / src / cache.js View on Github external
.continueWith(() => {
        entry.stream = most.empty();
        compressCache(entry);
        return most.empty();
      })
      .multicast();
github motorcyclejs / motorcyclejs / dom / src / mockDomSource.ts View on Github external
constructor(private _mockConfig: MockConfig) {
    if ((_mockConfig as any).elements) {
      this._elements = (_mockConfig as any).elements;
    } else {
      this._elements = empty();
    }
  }
github interlockjs / interlock / src / ast / traverse.js View on Github external
export function getTraversableAst (node, key = null, parents = []) {
  let type;
  let children;
  if (_.isObject(node) && node.type) {
    type = NODE;
    children = getNodeChildren(node, parents);
  } else if (_.isArray(node)) {
    type = ARRAY;
    children = getArrayChildren(node, parents);
  } else {
    type = OTHER;
    children = most.empty();
  }

  return { node, type, key, children, parents };
}