renovate/lib/manager/github-actions/extract.spec.ts
2020-02-05 01:14:31 +01:00

30 lines
938 B
TypeScript

import { readFileSync } from 'fs';
import { extractPackageFile } from './extract';
const workflow1 = readFileSync(
'lib/manager/github-actions/__fixtures__/main.workflow.1',
'utf8'
);
const workflow2 = readFileSync(
'lib/manager/github-actions/__fixtures__/workflow.yml.1',
'utf8'
);
describe('lib/manager/github-actions/extract', () => {
describe('extractPackageFile()', () => {
it('returns null for empty', () => {
expect(extractPackageFile('nothing here')).toBeNull();
});
it('extracts multiple image lines from docker_container', () => {
const res = extractPackageFile(workflow1);
expect(res.deps).toMatchSnapshot();
expect(res.deps).toHaveLength(2);
});
it('extracts multiple image lines from yaml configuration file', () => {
const res = extractPackageFile(workflow2);
expect(res.deps).toMatchSnapshot();
expect(res.deps).toHaveLength(2);
});
});
});