renovate/lib/manager/terragrunt/extract.spec.ts
2020-11-12 16:37:15 +01:00

25 lines
805 B
TypeScript

import { readFileSync } from 'fs';
import { extractPackageFile } from './extract';
const tg1 = readFileSync('lib/manager/terragrunt/__fixtures__/2.hcl', 'utf8');
const tg2 = `terragrunt {
source = "../../modules/fe"
}
`;
describe('lib/manager/terragrunt/extract', () => {
describe('extractPackageFile()', () => {
it('returns null for empty', () => {
expect(extractPackageFile('nothing here')).toBeNull();
});
it('extracts terragrunt sources', () => {
const res = extractPackageFile(tg1);
expect(res).toMatchSnapshot();
expect(res.deps).toHaveLength(30);
expect(res.deps.filter((dep) => dep.skipReason)).toHaveLength(5);
});
it('returns null if only local terragrunt deps', () => {
expect(extractPackageFile(tg2)).toBeNull();
});
});
});