Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const validate = async function ({ directory, repository }) {
/* eslint-disable global-require */
const packageJson = require(path.join(directory, 'package.json'));
/* eslint-enable global-require */
assert.that(packageJson.version).is.equalTo('1.0.0');
const listTags = shell.ls(`${repository}/refs/tags`);
const tags = listTags.stdout.split('\n');
assert.that(tags[0]).is.equalTo('1.0.0');
};
test('has configure and getLogger functions.', async (): Promise => {
/* eslint-disable @typescript-eslint/unbound-method */
assert.that(flaschenpost.configure).is.ofType('function');
assert.that(flaschenpost.getLogger).is.ofType('function');
/* eslint-enable @typescript-eslint/unbound-method */
});
test('has configure and getLogger functions.', async (): Promise => {
/* eslint-disable @typescript-eslint/unbound-method */
assert.that(flaschenpost.configure).is.ofType('function');
assert.that(flaschenpost.getLogger).is.ofType('function');
/* eslint-enable @typescript-eslint/unbound-method */
});
const constraint = `>=${latestVersion} <${semver.inc(latestVersion, 'major')}`;
/* eslint-disable global-require */
const packageJson = await fs.readFile(path.join(directory, 'package.json'), { encoding: 'utf-8' });
/* eslint-enable global-require */
const newPackageJson = stripIndent`
{
"name": "test-package",
"version": "0.0.1",
"engines": {
"node": "${constraint}"
}
}`;
assert.that(packageJson).is.atLeast(`${newPackageJson}\n`);
};
const validate = async function ({ directory }) {
/* eslint-disable global-require */
const packageJson = require(path.join(directory, 'package.json'));
/* eslint-enable global-require */
assert.that(packageJson.version).is.equalTo('0.1.0');
};
test('sets itself as its successor if the successors list only has one element.', done => {
peer.setSuccessor({ host: 'example.com', port: 3000 });
peer.successors = [{ host: 'foo.com', port: 3000 }];
peer.fixSuccessor();
assert.that(peer.successor).is.equalTo(peer.self);
done();
});
test('initially contains information on the endpoint of the peer.', done => {
assert.that(peer.predecessor).is.equalTo({
host: 'localhost',
port: 3000,
id: sha1('localhost:3000')
});
done();
});
});
}, (code, stdout, stderr) => {
assert.that(code).is.equalTo(0);
const messages = stdout.split('\n').
filter(line => line !== '').
map(line => JSON.parse(line));
assert.that(messages[0].level).is.equalTo('info');
assert.that(messages[0].message).is.equalTo('Application started.');
assert.that(messages[1].level).is.equalTo('error');
assert.that(messages[1].message).is.equalTo('Something, somewhere went horribly wrong...');
assert.that(stderr).is.equalTo('');
done();
});
});
test('is a function.', done => {
assert.that(handle).is.ofType('function');
done();
});
test('is an object.', done => {
assert.that(p2p).is.ofType('object');
done();
});