"lib/modules/manager/git-submodules/extract.ts" did not exist on "fbbbce608e5df637ac5a6447774d38e03b2e79fc"
Select Git revision
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',