Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var upstream = results[1].upstream;
var installedThriftFile =
localApp.thrift['github.com'].org.b['service.thrift'];
var installedMetaFile =
JSON.parse(localApp.thrift['github.com'].org.b['meta.json']);
// var localAppMetaFile = JSON.parse(localApp.thrift['meta.json']);
assert.equal(
installedThriftFile,
upstream.files['thrift/github.com/org/b/service.thrift'],
'Correct thrift file installed'
);
assert.deepEqual(
installedMetaFile.shasums,
upstream.meta.remotes['github.com/org/b'].shasums,
'Correct files and shasums for installed module'
);
assert.end();
}
});
// Fetch B locally
assert.equal(
data[3].local.idl['github.com'].org.b['service.thrift'],
thriftIdl('B'),
'Correct thrift B file locally'
);
assert.equal(
data[3].local.idl['meta.json'].version,
now + 2000,
'Correct meta.json version'
);
assert.equal(
data[3].local.idl['meta.json'].remotes['github.com/org/b'].time,
(new Date(now + 2000)).toISOString(),
'Correct version of B'
);
assert.equal(
data[3].local.idl['meta.json'].remotes['github.com/org/a'].time,
(new Date(now + 1000)).toISOString(),
'Correct version of A'
);
// Remote A and B updated and published. Update run.
assert.equal(
data[8].local.idl['github.com'].org.a['service.thrift'],
template(updatedThriftIdlTemplate, { remoteName: 'A' }),
'Correct thrift A file locally'
);
function onInspect(err, data) {
if (err) {
assert.ifError(err);
}
var local = data.local;
var upstream = data.upstream;
var meta = JSON.parse(local.thrift['meta.json']);
assert.equal(
meta.time,
upstream.meta.remotes['github.com/org/b'].time
);
assert.equal(
meta.version,
new Date(upstream.meta.remotes['github.com/org/b'].time).getTime()
);
assert.deepEqual(
meta.remotes['github.com/org/b'],
upstream.meta.remotes['github.com/org/b']
);
assert.deepEqual(
meta.remotes['github.com/org/d'],
upstream.meta.remotes['github.com/org/d']
);
assert.equal(
);
assert.equal(data.meta.time,
data.meta.remotes['github.com/org/d'].time);
assert.equal(new Date(data.meta.time).getTime(),
data.meta.version);
assert.deepEqual(
data.meta.remotes['github.com/org/a'].shasums,
{
'service.thrift': 'd329c8c24d0871076a5f05180a439bccb9bebe71'
},
'Correct shasums for remote A'
);
assert.deepEqual(
data.meta.remotes['github.com/org/b'].shasums,
{
'service.thrift': '424a6ca9b4660bf432045eeba7a3254ab38d5701'
},
'Correct shasums for remote B'
);
assert.deepEqual(
data.meta.remotes['github.com/org/c'].shasums,
{
'service.thrift': '484742978a072e46ae1131d8efe7fe0377d35c54'
},
'Correct shasums for remote C'
);
assert.deepEqual(
data.meta.remotes['github.com/org/d'].shasums,
{
'service.thrift': 'cf9c2141b3dbb05bcbaa31579b883697d42c7f8d'
assert.equal(
data.files['idl/github.com/org/c/service.thrift'],
thriftIdl('C'),
'Correct thrift definition for C'
);
assert.equal(
data.files['idl/github.com/org/d/service.thrift'],
thriftIdl('D'),
'Correct thrift definition for D'
);
var remotes = data.meta.remotes;
assert.equal(data.gittag, '' +
'v' + new Date(remotes['github.com/org/a'].time).getTime() + '\n' +
'v' + new Date(remotes['github.com/org/b'].time).getTime() + '\n' +
'v' + new Date(remotes['github.com/org/c'].time).getTime() + '\n' +
'v' + new Date(remotes['github.com/org/d'].time).getTime() + '\n'
);
assert.end();
}
});
var local = data.local;
var upstream = data.upstream;
var meta = JSON.parse(local.thrift['meta.json']);
assert.equal(
meta.time,
upstream.meta.remotes['github.com/org/b'].time
);
assert.equal(
meta.version,
new Date(upstream.meta.remotes['github.com/org/b'].time).getTime()
);
assert.deepEqual(
meta.remotes['github.com/org/b'],
upstream.meta.remotes['github.com/org/b']
);
assert.deepEqual(
meta.remotes['github.com/org/d'],
upstream.meta.remotes['github.com/org/d']
);
assert.equal(
local.thrift['github.com'].org.b['service.thrift'],
upstream.files['thrift/github.com/org/b/service.thrift']
);
assert.equal(
local.thrift['github.com'].org.d['service.thrift'],
upstream.files['thrift/github.com/org/d/service.thrift']
);
function onUpstream(err, data) {
if (err) {
assert.ifError(err);
}
assert.equal(data.gitlog,
'Updating B to latest version\n' +
'Updating D to latest version\n' +
'Updating C to latest version\n' +
'Updating B to latest version\n' +
'Updating A to latest version\n' +
'initial\n'
);
assert.equal(data.meta.time,
data.meta.remotes['github.com/org/b'].time);
assert.equal(new Date(data.meta.time).getTime(),
data.meta.version);
assert.deepEqual(
Object.keys(data.files).sort(),
[
'idl/github.com/org/a/service.thrift',
'idl/github.com/org/b/service.thrift',
'idl/github.com/org/c/service.thrift',
'idl/github.com/org/d/service.thrift',
'meta.json'
],
'Upstream contains all expected files'
);
assert.deepEqual(
var upstream = data.upstream;
var meta = JSON.parse(local.thrift['meta.json']);
assert.equal(
meta.time,
upstream.meta.remotes['github.com/org/b'].time
);
assert.equal(
meta.version,
new Date(upstream.meta.remotes['github.com/org/b'].time).getTime()
);
assert.deepEqual(
meta.remotes['github.com/org/b'],
upstream.meta.remotes['github.com/org/b']
);
assert.deepEqual(
meta.remotes['github.com/org/d'],
upstream.meta.remotes['github.com/org/d']
);
assert.equal(
local.thrift['github.com'].org.b['service.thrift'],
upstream.files['thrift/github.com/org/b/service.thrift']
);
assert.equal(
local.thrift['github.com'].org.d['service.thrift'],
upstream.files['thrift/github.com/org/d/service.thrift']
);
assert.end();
function onResults(err, data) {
if (err) {
assert.ifError(err);
}
var list = data.list;
var upstream = data.upstream;
assert.equal(
upstream.meta.remotes['github.com/org/a'].time,
list.remotes['github.com/org/a'].time
);
assert.equal(
upstream.meta.remotes['github.com/org/b'].time,
list.remotes['github.com/org/b'].time
);
assert.equal(
upstream.meta.remotes['github.com/org/c'].time,
list.remotes['github.com/org/c'].time
);
assert.equal(
upstream.meta.remotes['github.com/org/d'].time,
list.remotes['github.com/org/d'].time
);
var text = list.toString();
assert.equal(
text,
' - github.com/org/a ' + upstream.meta.remotes['github.com/org/a']
function onUpstream(err, data) {
if (err) {
assert.ifError(err);
}
assert.equal(data.gitlog,
'Updating B to latest version\n' +
'Updating D to latest version\n' +
'Updating C to latest version\n' +
'Updating B to latest version\n' +
'Updating A to latest version\n' +
'initial\n'
);
assert.equal(data.meta.time,
data.meta.remotes['github.com/org/b'].time);
assert.equal(new Date(data.meta.time).getTime(),
data.meta.version);
assert.deepEqual(
Object.keys(data.files).sort(),
[
'idl/github.com/org/a/service.thrift',
'idl/github.com/org/b/service.thrift',
'idl/github.com/org/c/service.thrift',
'idl/github.com/org/d/service.thrift',
'meta.json'
],
'Upstream contains all expected files'
);
assert.deepEqual(