How to use @adobe/helix-testutils - 4 common examples

To help you get started, we’ve selected a few @adobe/helix-testutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / helix-cli / test / testGitUtils.js View on Github external
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' });
  });
github adobe / helix-cli / test / testGitUtils.js View on Github external
});

  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');
  });
});
github adobe / helix-cli / test / testGitUtils.js View on Github external
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');
  });
});
github adobe / helix-cli / test / testGitUtils.js View on Github external
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');
  });

@adobe/helix-testutils

Helix Testing Utilities

Apache-2.0
Latest version published 21 days ago

Package Health Score

73 / 100
Full package analysis

Popular @adobe/helix-testutils functions

Similar packages