renovate/lib/manager/terragrunt/extract.spec.ts
Sergei Zharinov b255275632
refactor(test): Load fixtures with helpers (#9699)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-04-23 16:58:48 +00:00

25 lines
783 B
TypeScript

import { getName, loadFixture } from '../../../test/util';
import { extractPackageFile } from './extract';
const tg1 = loadFixture(__filename, '2.hcl');
const tg2 = `terragrunt {
source = "../../modules/fe"
}
`;
describe(getName(__filename), () => {
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();
});
});
});