How to use the shipjs-lib.getCurrentBranch.mockImplementation function in shipjs-lib

To help you get started, we’ve selected a few shipjs-lib 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 algolia / shipjs / packages / shipjs / src / helper / __tests__ / validateBeforePrepare.spec.js View on Github external
it('does not return error if current branch is correct', () => {
    getCurrentBranch.mockImplementation(() => 'master');
    const result = validate(defaultOpts);
    expect(result).toBe(true);
  });
github algolia / shipjs / packages / shipjs / src / step / prepare / __tests__ / validate.spec.js View on Github external
it('works', () => {
    validateBeforePrepare.mockImplementation(() => true);
    const version = '1.2.3';
    const branch = 'legacy';
    getCurrentVersion.mockImplementation(() => version);
    getCurrentBranch.mockImplementation(() => branch);
    const { currentVersion, baseBranch } = validate({
      config: {
        getTagName: () => 'v1.2.3',
        mergeStrategy: {
          toSameBranch: ['master'],
          toReleaseBranch: {
            legacy: 'v1',
          },
        },
      },
    });
    expect(currentVersion).toEqual(version);
    expect(baseBranch).toEqual(branch);
    expect(exitProcess).toHaveBeenCalledTimes(0);
  });