mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 16:46:25 +00:00
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
/* eslint-disable no-template-curly-in-string */
|
|
import { readFileSync } from 'fs';
|
|
import { resolve } from 'upath';
|
|
import { extractPackage } from './extract';
|
|
|
|
const minimumContent = readFileSync(
|
|
resolve(__dirname, `./__fixtures__/minimum.pom.xml`),
|
|
'utf8'
|
|
);
|
|
|
|
const simpleContent = readFileSync(
|
|
resolve(__dirname, `./__fixtures__/simple.pom.xml`),
|
|
'utf8'
|
|
);
|
|
|
|
describe('manager/maven/extract', () => {
|
|
describe('extractDependencies', () => {
|
|
it('returns null for invalid XML', () => {
|
|
expect(extractPackage(undefined)).toBeNull();
|
|
expect(extractPackage('invalid xml content')).toBeNull();
|
|
expect(extractPackage('<foobar></foobar>')).toBeNull();
|
|
expect(extractPackage('<project></project>')).toBeNull();
|
|
});
|
|
|
|
it('extract dependencies from any XML position', () => {
|
|
const res = extractPackage(simpleContent);
|
|
expect(res).toMatchSnapshot();
|
|
});
|
|
it('tries minimum manifests', () => {
|
|
const res = extractPackage(minimumContent);
|
|
expect(res).toMatchSnapshot();
|
|
});
|
|
});
|
|
});
|