Skip to content
Snippets Groups Projects
Select Git revision
  • 081a23e6fcd54835290eba09ca4be79ffcc4b639
  • main default protected
  • next
  • revert-31645-feat/rename-gradle-wrapper-validation-action
  • renovate/main-redis-5.x
  • fix/36615b-branch-reuse-no-cache
  • chore/punycode
  • fix/36615-branch-reuse-bug
  • refactor/pin-new-value
  • feat/36219--git-x509-signing
  • feat/structured-logger
  • hotfix/39.264.1
  • feat/skip-dangling
  • gh-readonly-queue/next/pr-36034-7a061c4ca1024a19e2c295d773d9642625d1c2be
  • hotfix/39.238.3
  • refactor/gitlab-auto-approve
  • feat/template-strings
  • gh-readonly-queue/next/pr-35654-137d934242c784e0c45d4b957362214f0eade1d7
  • fix/32307-global-extends-merging
  • fix/32307-global-extends-repositories
  • gh-readonly-queue/next/pr-35009-046ebf7cb84ab859f7fefceb5fa53a54ce9736f8
  • 41.34.1
  • 41.34.0
  • 41.33.0
  • 41.32.3
  • 41.32.2
  • 41.32.1
  • 41.32.0
  • 41.31.1
  • 41.31.0
  • 41.30.5
  • 41.30.4
  • 41.30.3
  • 41.30.2
  • 41.30.1
  • 41.30.0
  • 41.29.1
  • 41.29.0
  • 41.28.2
  • 41.28.1
  • 41.28.0
41 results

common.ts

Blame
  • artifacts.spec.ts 9.89 KiB
    import { join } from 'upath';
    import { envMock, exec, mockExecAll } from '../../../../test/exec-util';
    import { env, fs, git, mocked } from '../../../../test/util';
    import { GlobalConfig } from '../../../config/global';
    import type { RepoGlobalConfig } from '../../../config/types';
    import * as docker from '../../../util/exec/docker';
    import type { StatusResult } from '../../../util/git/types';
    import * as _datasource from '../../datasource';
    import type { UpdateArtifactsConfig } from '../types';
    import { updateArtifacts } from '.';
    
    jest.mock('../../../util/exec/common');
    jest.mock('../../../util/exec/env');
    jest.mock('../../../util/git');
    jest.mock('../../../util/fs');
    jest.mock('../../platform');
    jest.mock('../../datasource');
    
    const datasource = mocked(_datasource);
    
    delete process.env.CP_HOME_DIR;
    
    const config: UpdateArtifactsConfig = {};
    
    const adminConfig: RepoGlobalConfig = {
      localDir: join('/tmp/github/some/repo'),
      cacheDir: join('/tmp/cache'),
    };
    
    describe('modules/manager/cocoapods/artifacts', () => {
      beforeEach(() => {
        jest.resetAllMocks();
        env.getChildProcessEnv.mockReturnValue(envMock.basic);
        jest.spyOn(docker, 'removeDockerContainer').mockResolvedValue();
        // can't be mocked
        docker.resetPrefetchedImages();
    
        GlobalConfig.set(adminConfig);
    
        datasource.getPkgReleases.mockResolvedValue({
          releases: [
            { version: '2.7.4' },
            { version: '3.0.0' },
            { version: '3.1.0' },
          ],
        });
      });
    
      afterEach(() => {
        GlobalConfig.reset();
      });
    
      it('returns null if no Podfile.lock found', async () => {
        const execSnapshots = mockExecAll(exec);
        expect(
          await updateArtifacts({
            packageFileName: 'Podfile',
            updatedDeps: [{ depName: 'foo' }],
            newPackageFileContent: '',
            config,
          })
        ).toBeNull();
        expect(execSnapshots).toMatchSnapshot();
      });
    
      it('returns null if no updatedDeps were provided', async () => {
        const execSnapshots = mockExecAll(exec);
        expect(
          await updateArtifacts({
            packageFileName: 'Podfile',