How to use the @xviz/parser.unpackEnvelope function in @xviz/parser

To help you get started, we’ve selected a few @xviz/parser 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 uber / xviz / test / modules / parser / parsers / parse-xviz-message-sync.spec.js View on Github external
tape('unpackEnvelope name parsing', t => {
  const notype = unpackEnvelope({type: 'foo', data: {a: 42}});
  t.equals(notype.namespace, 'foo');
  t.equals(notype.type, '');

  const empty = unpackEnvelope({type: '', data: {a: 42}});
  t.equals(empty.namespace, '');
  t.equals(empty.type, '');

  const nonXVIZ = unpackEnvelope({type: 'foo/bar', data: {a: 42}});
  t.equals(nonXVIZ.namespace, 'foo');
  t.equals(nonXVIZ.type, 'bar');

  const leadingSlash = unpackEnvelope({type: '/foo/bar', data: {a: 42}});
  t.equals(leadingSlash.namespace, '');
  t.equals(leadingSlash.type, 'foo/bar');

  t.end();
github uber / xviz / test / modules / parser / parsers / parse-xviz-message-sync.spec.js View on Github external
tape('unpackEnvelope xviz', t => {
  const enveloped = {
    type: 'xviz/state_update',
    data: {a: 42}
  };
  const expected = {
    namespace: 'xviz',
    type: 'state_update',
    data: enveloped.data
  };
  t.deepEquals(unpackEnvelope(enveloped), expected);

  t.end();
});
github uber / xviz / test / modules / parser / parsers / parse-xviz-message-sync.spec.js View on Github external
tape('unpackEnvelope name parsing', t => {
  const notype = unpackEnvelope({type: 'foo', data: {a: 42}});
  t.equals(notype.namespace, 'foo');
  t.equals(notype.type, '');

  const empty = unpackEnvelope({type: '', data: {a: 42}});
  t.equals(empty.namespace, '');
  t.equals(empty.type, '');

  const nonXVIZ = unpackEnvelope({type: 'foo/bar', data: {a: 42}});
  t.equals(nonXVIZ.namespace, 'foo');
  t.equals(nonXVIZ.type, 'bar');

  const leadingSlash = unpackEnvelope({type: '/foo/bar', data: {a: 42}});
  t.equals(leadingSlash.namespace, '');
  t.equals(leadingSlash.type, 'foo/bar');

  t.end();
});
github uber / xviz / test / modules / parser / parsers / parse-xviz-message-sync.spec.js View on Github external
tape('unpackEnvelope name parsing', t => {
  const notype = unpackEnvelope({type: 'foo', data: {a: 42}});
  t.equals(notype.namespace, 'foo');
  t.equals(notype.type, '');

  const empty = unpackEnvelope({type: '', data: {a: 42}});
  t.equals(empty.namespace, '');
  t.equals(empty.type, '');

  const nonXVIZ = unpackEnvelope({type: 'foo/bar', data: {a: 42}});
  t.equals(nonXVIZ.namespace, 'foo');
  t.equals(nonXVIZ.type, 'bar');

  const leadingSlash = unpackEnvelope({type: '/foo/bar', data: {a: 42}});
  t.equals(leadingSlash.namespace, '');
  t.equals(leadingSlash.type, 'foo/bar');

  t.end();
});
github uber / xviz / test / modules / parser / parsers / parse-xviz-message-sync.spec.js View on Github external
tape('unpackEnvelope name parsing', t => {
  const notype = unpackEnvelope({type: 'foo', data: {a: 42}});
  t.equals(notype.namespace, 'foo');
  t.equals(notype.type, '');

  const empty = unpackEnvelope({type: '', data: {a: 42}});
  t.equals(empty.namespace, '');
  t.equals(empty.type, '');

  const nonXVIZ = unpackEnvelope({type: 'foo/bar', data: {a: 42}});
  t.equals(nonXVIZ.namespace, 'foo');
  t.equals(nonXVIZ.type, 'bar');

  const leadingSlash = unpackEnvelope({type: '/foo/bar', data: {a: 42}});
  t.equals(leadingSlash.namespace, '');
  t.equals(leadingSlash.type, 'foo/bar');

  t.end();
});