Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
var t = require('tap');
var MendelServerVariationWalker = require('../packages/mendel-core/tree-variation-walker-server');
t.equals(MendelServerVariationWalker().constructor, MendelServerVariationWalker, 'constructor');
var stub1 = {
index: 0,
id: 'first',
variations: ['a', 'b', 'special'],
data: [
{id:'a', sha:'ba', variation: 'a'},
{id:'b', variation: 'b'},
{id:'special', 'variation': 'special'},
],
};
var walker = MendelServerVariationWalker([['a'],['special']], 'special');
walker.find(stub1);
t.same(walker.found(),
{ first: 'a' },
/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
var t = require('tap');
var MendelVariationWalker = require('../packages/mendel-core/tree-variation-walker');
t.equals(MendelVariationWalker().constructor, MendelVariationWalker, 'constructor');
var stub1 = {
index: 0,
id: 'first',
variations: ['a', 'b', 'special'],
data: [{id:'a', sha:'ba'},{id:'b'},{id:'special'}],
};
var walker = MendelVariationWalker([['a'],['special']], 'special');
var ret = walker._resolveBranch(stub1);
t.match(ret, {index:0, resolved:{id:'a'}},
'returns first match');
t.match(walker.conflicts, 0,
'no conflicts with base');
/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
var t = require('tap');
var MendelWalker = require('../packages/mendel-core/tree-walker');
var walker = MendelWalker();
t.equals(walker.constructor, MendelWalker, 'constructor');
var shallowModule = {
id: 'root',
index: 0,
data: [{
id: 'stubData',
sha: '010203',
}],
};
t.equals(walker.find(shallowModule).id, 'stubData',
'Shallow module won\'t call _resolveBranch');
t.equals(walker.find({index:0}).id, 'stubData',
'Caches result by index');
var walker = MendelVariationWalker([['a'],['special']], 'special');
var ret = walker._resolveBranch(stub1);
t.match(ret, {index:0, resolved:{id:'a'}},
'returns first match');
t.match(walker.conflicts, 0,
'no conflicts with base');
walker = new MendelVariationWalker([['nope'], ['b'],['special']], 'special');
ret = walker._resolveBranch(stub1);
t.match(ret, {index:1, resolved:{id:'b'}},
'returns first match');
t.equals(walker.conflicts, 0,
'no conflicts with base');
walker = new MendelVariationWalker([['a', 'b'],['special']], 'special');
ret = walker._resolveBranch(stub1);
t.equals(walker.conflicts, 0,
'Two variations on the same level don\'t conflict');
walker = new MendelVariationWalker([['a'], ['b'],['special']], 'special');
ret = walker.find(stub1);
t.equals(walker.conflicts, 1,
'detects conflicts');
t.match(walker.conflictList, {'first':true},
'conflicts map');
function handleEvent(ifaceName, eventName) {
test.equals(ifaceName, iface, 'interface name must match');
test.equals(eventName, event, 'event name must match');
client.kill();
server.close();
}
{
"alternatives": [
{
"confidence": null,
"content": "."
}
],
"type": "punctuation"
}
]
},
"status": "COMPLETED"
});
tap.equals(result,
`WEBVTT
1
00:00:07.840 --> 00:00:12.870
Wait.
`);
function handleEvent(ifaceName, eventName) {
test.equals(ifaceName, iface, 'interface name must match');
test.equals(eventName, event, 'event name must match');
client.kill();
server.close();
}
import fs from 'fs';
import tap from 'tap';
import vttConvert from '../index.js';
for (const sample of [ 'expert', 'se-radio' ]) {
const json = JSON.parse(fs.readFileSync(__dirname + '/data/' + sample + '.json'));
const vtt = fs.readFileSync(__dirname + '/data/' + sample + '.vtt', 'utf8');
tap.equals(vtt, vttConvert(json));
}
t.match(ret, {index:1, resolved:{id:'b'}},
'returns first match');
t.equals(walker.conflicts, 0,
'no conflicts with base');
walker = new MendelVariationWalker([['a', 'b'],['special']], 'special');
ret = walker._resolveBranch(stub1);
t.equals(walker.conflicts, 0,
'Two variations on the same level don\'t conflict');
walker = new MendelVariationWalker([['a'], ['b'],['special']], 'special');
ret = walker.find(stub1);
t.equals(walker.conflicts, 1,
'detects conflicts');
t.match(walker.conflictList, {'first':true},
'conflicts map');
t.match(walker.found(), {
deps: [ { id: 'a', sha: 'ba' } ],
hash: 'bWVuZGVsAQD_AQAGH7IIQx23k7vTZFt6FgWKHiokEg',
conflicts: 1,
conflictList: { first: true } },
'full result inherits from MendelWalker');