renovate/lib/manager/pub/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

22 lines
814 B
TypeScript

import { getName, loadFixture } from '../../../test/util';
import { extractPackageFile } from '.';
const brokenYaml = loadFixture(__filename, 'update.yaml');
const packageFile = loadFixture(__filename, 'extract.yaml');
describe(getName(__filename), () => {
describe('extractPackageFile', () => {
it('should return null if package does not contain any deps', () => {
const res = extractPackageFile('foo: bar', 'pubspec.yaml');
expect(res).toBeNull();
});
it('should return null if package is invalid', () => {
const res = extractPackageFile(brokenYaml, 'pubspec.yaml');
expect(res).toBeNull();
});
it('should return valid dependencies', () => {
const res = extractPackageFile(packageFile, 'pubspec.yaml');
expect(res).toMatchSnapshot();
});
});
});