Skip to content

Commit

Permalink
remove hard error
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Aug 16, 2019
1 parent 7946923 commit d0119a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
4 changes: 0 additions & 4 deletions modules/parser/src/synchronizers/xviz-stream-buffer.js
Expand Up @@ -365,10 +365,6 @@ export default class XVIZStreamBuffer {
}

for (const streamName in streams) {
assert(
!(streamName in this.streams),
`${streamName} found in both persistent and non-persistent updates`
);
if (!(streamName in persistentStreams)) {
persistentStreams[streamName] = true;
this.streamCount++;
Expand Down
34 changes: 11 additions & 23 deletions test/modules/parser/synchronizers/xviz-stream-buffer.spec.js
Expand Up @@ -316,14 +316,6 @@ test('XVIZStreamBuffer#insert#PERSISTENT', t => {
streams: {Y: null}
},
expect: {A: 5, X: 20, Y: 20, Z: -1}
},
{
title: 'conflict',
message: {
updateType: 'PERSISTENT',
streams: {A: 3}
},
error: true
}
];

Expand All @@ -335,21 +327,17 @@ test('XVIZStreamBuffer#insert#PERSISTENT', t => {

for (const testCase of testCases) {
const {lastUpdate} = xvizStreamBuffer;
if (testCase.error) {
t.throws(() => xvizStreamBuffer.insert(testCase.message), 'insertion should throw');
} else {
t.ok(xvizStreamBuffer.insert(testCase.message), 'persistent timeslice inserted');
t.ok(xvizStreamBuffer.lastUpdate > lastUpdate, 'update counter updated');

const timeslices = xvizStreamBuffer.getTimeslices({start: 1000, end: 1001});
const streams = {};
timeslices.forEach(timeslice => {
for (const streamName in timeslice.streams) {
streams[streamName] = timeslice.streams[streamName] || streams[streamName];
}
});
t.deepEqual(streams, testCase.expect, `${testCase.title}: returns correct streams`);
}
t.ok(xvizStreamBuffer.insert(testCase.message), 'persistent timeslice inserted');
t.ok(xvizStreamBuffer.lastUpdate > lastUpdate, 'update counter updated');

const timeslices = xvizStreamBuffer.getTimeslices({start: 1000, end: 1001});
const streams = {};
timeslices.forEach(timeslice => {
for (const streamName in timeslice.streams) {
streams[streamName] = timeslice.streams[streamName] || streams[streamName];
}
});
t.deepEqual(streams, testCase.expect, `${testCase.title}: returns correct streams`);
}

t.end();
Expand Down

0 comments on commit d0119a5

Please sign in to comment.