renovate/lib/modules/manager/helm-values/extract.spec.ts
Jamie Magee 3589d0e222
refactor: remove deprecated loadFixture calls (#16404)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-07-04 04:18:53 +00:00

46 lines
1.3 KiB
TypeScript

import { Fixtures } from '../../../../test/fixtures';
import { extractPackageFile } from '.';
const helmDefaultChartInitValues = Fixtures.get(
'default_chart_init_values.yaml'
);
const helmMultiAndNestedImageValues = Fixtures.get(
'multi_and_nested_image_values.yaml'
);
describe('modules/manager/helm-values/extract', () => {
describe('extractPackageFile()', () => {
beforeEach(() => {
jest.resetAllMocks();
});
it('returns null for invalid yaml file content', () => {
const result = extractPackageFile('nothing here: [');
expect(result).toBeNull();
});
it('returns null for empty yaml file content', () => {
const result = extractPackageFile('');
expect(result).toBeNull();
});
it('extracts from values.yaml correctly with same structure as "helm create"', () => {
const result = extractPackageFile(helmDefaultChartInitValues);
expect(result).toMatchSnapshot({
deps: [
{
currentValue: '1.16.1',
depName: 'nginx',
},
],
});
});
it('extracts from complex values file correctly"', () => {
const result = extractPackageFile(helmMultiAndNestedImageValues);
expect(result).toMatchSnapshot();
expect(result?.deps).toHaveLength(5);
});
});
});