How to use the shipjs-lib.getCurrentVersion.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 / 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);
  });