How to use the @xviz/parser.LogSynchronizer 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 / synchronizers / log-synchronizer.spec.js View on Github external
{attributes: {transmission_time: 110}, value: 2},
      {attributes: {transmission_time: 115}},
      {attributes: {transmission_time: 120}, value: 3}
    ],
    stream2: [
      {time: 90},
      {time: 102, value: 10},
      {time: 103},
      {time: 110, value: 20},
      {time: 115},
      {time: 121, value: 40},
      {time: 122}
    ]
  };

  const logSynchronizer = new LogSynchronizer(LOGS_WITH_NO_DATA_ENTRIES);

  // Test a time before any valid entries
  logSynchronizer.setTime(99);
  let data = logSynchronizer.getLogSlice();
  t.equals(data.streams.stream1, undefined, 'stream1 is undefined at time 99');
  t.equals(data.streams.stream2, undefined, 'stream2 is undefined at time 99');

  // Test with a valid entry for stream1 and no entry in the window for stream2
  logSynchronizer.setTime(100);
  data = logSynchronizer.getLogSlice();
  t.equals(data.streams.stream1.value, 1, 'stream1 is 1 at time 100');
  t.equals(data.streams.stream2, undefined, 'stream2 is undefined at time 100');

  // Test with a valid entry for both logs
  logSynchronizer.setTime(102);
  data = logSynchronizer.getLogSlice();
github uber / xviz / test / modules / parser / synchronizers / log-synchronizer.spec.js View on Github external
tape('LogSynchronizer#getData', t => {
  resetXVIZConfigAndSettings();
  setXVIZConfig({TIME_WINDOW: 3});
  const logSynchronizer = new LogSynchronizer(LOGS);

  for (const tc of TEST_CASES) {
    const {time, log1, log2} = tc;
    logSynchronizer.setTime(time);
    const data = logSynchronizer.getLogSlice();
    t.comment(`Set time to ${time}`);
    if (log1) {
      if (log1 === 'empty_entry') {
        t.equals(data.streams.log1.value, undefined, 'Got correct empty entry for log1');
      } else {
        t.equals(data.streams.log1.value, log1, 'Got correct log1 value');
      }
    } else {
      t.equals(data.streams.log1, undefined, 'Got undefined log1 value');
    }
github uber / xviz / test / modules / parser / synchronizers / log-synchronizer.spec.js View on Github external
tape('LogSynchronizer#setTime', t => {
  const logSynchronizer = new LogSynchronizer(LOGS);
  logSynchronizer.setTime(10);
  t.equals(logSynchronizer.getTime(), 10, 'Set and retrieved time');
  t.end();
});
github uber / xviz / test / modules / parser / synchronizers / log-synchronizer.spec.js View on Github external
tape('LogSynchronizer#constructor', t => {
  const logSynchronizer = new LogSynchronizer(LOGS);
  t.ok(logSynchronizer instanceof LogSynchronizer, 'Constructed');
  t.end();
});