Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Tests against the helix-cli repo', () => {
function ishelix() {
if (process.env.CIRCLE_REPOSITORY_URL) {
return !!process.env.CIRCLE_REPOSITORY_URL.match('helix-cli');
}
return true;
}
condit('resolveCommit resolves the correct commit for tags', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'v1.0.0');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit resolves the correct commit for shortened OID', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'f9ab59c');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit throws for unknown ref', ishelix, async () => {
await assert.rejects(async () => GitUtils.resolveCommit('.', 'v99.unicorn.foobar'), { code: 'ResolveRefError' });
});
it('resolveCommit throws for invalid argument type', async () => {
await assert.rejects(async () => GitUtils.resolveCommit(1.0, true), { name: 'TypeError' });
});
});
condit('resolveCommit resolves the correct commit for shortened OID', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'f9ab59c');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit throws for unknown ref', ishelix, async () => {
await assert.rejects(async () => GitUtils.resolveCommit('.', 'v99.unicorn.foobar'), { code: 'ResolveRefError' });
});
it('resolveCommit throws for invalid argument type', async () => {
await assert.rejects(async () => GitUtils.resolveCommit(1.0, true), { name: 'TypeError' });
});
condit('getRawContent gets the correct version', ishelix, async () => {
const content = await GitUtils.getRawContent('.', 'v1.0.0', 'package.json');
assert.equal(JSON.parse(content.toString()).version, '1.0.0');
});
});
return !!process.env.CIRCLE_REPOSITORY_URL.match('helix-cli');
}
return true;
}
condit('resolveCommit resolves the correct commit for tags', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'v1.0.0');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit resolves the correct commit for shortened OID', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'f9ab59c');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit throws for unknown ref', ishelix, async () => {
await assert.rejects(async () => GitUtils.resolveCommit('.', 'v99.unicorn.foobar'), { code: 'ResolveRefError' });
});
it('resolveCommit throws for invalid argument type', async () => {
await assert.rejects(async () => GitUtils.resolveCommit(1.0, true), { name: 'TypeError' });
});
condit('getRawContent gets the correct version', ishelix, async () => {
const content = await GitUtils.getRawContent('.', 'v1.0.0', 'package.json');
assert.equal(JSON.parse(content.toString()).version, '1.0.0');
});
});
describe('Tests against the helix-cli repo', () => {
function ishelix() {
if (process.env.CIRCLE_REPOSITORY_URL) {
return !!process.env.CIRCLE_REPOSITORY_URL.match('helix-cli');
}
return true;
}
condit('resolveCommit resolves the correct commit for tags', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'v1.0.0');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit resolves the correct commit for shortened OID', ishelix, async () => {
const commit = await GitUtils.resolveCommit('.', 'f9ab59c');
assert.equal(commit, 'f9ab59cd2baa2860289d826e270938f2eedb3e59');
});
condit('resolveCommit throws for unknown ref', ishelix, async () => {
await assert.rejects(async () => GitUtils.resolveCommit('.', 'v99.unicorn.foobar'), { code: 'ResolveRefError' });
});
it('resolveCommit throws for invalid argument type', async () => {
await assert.rejects(async () => GitUtils.resolveCommit(1.0, true), { name: 'TypeError' });
});
condit('getRawContent gets the correct version', ishelix, async () => {
const content = await GitUtils.getRawContent('.', 'v1.0.0', 'package.json');
assert.equal(JSON.parse(content.toString()).version, '1.0.0');
});