Simplify test setup

This commit is contained in:
Jonas Rutishauser 2024-12-18 19:38:20 +01:00
parent ad35265b7f
commit 11114cbf00
No known key found for this signature in database
GPG key ID: 29B5398CFE794AA6

View file

@ -1,4 +1,5 @@
// TODO #22198 // TODO #22198
import { codeBlock } from 'common-tags';
import { XmlDocument } from 'xmldoc'; import { XmlDocument } from 'xmldoc';
import { Fixtures } from '../../../../test/fixtures'; import { Fixtures } from '../../../../test/fixtures';
import { bumpPackageVersion, updateDependency } from './update'; import { bumpPackageVersion, updateDependency } from './update';
@ -84,16 +85,24 @@ describe('modules/manager/maven/update', () => {
it('should do replacement if version is first', () => { it('should do replacement if version is first', () => {
const res = updateDependency({ const res = updateDependency({
fileContent: fileContent: codeBlock`
simpleContent.slice(0, 814) + <project xmlns="http://maven.apache.org/POM/4.0.0">
simpleContent.slice(890, 923) + <dependencyManagement>
simpleContent.slice(814, 890) + <dependencies>
simpleContent.slice(923), <dependency>
<version>0.0.1</version>
<artifactId>foo</artifactId>
<groupId>org.example</groupId>
</dependency>
</dependencies>
</dependencyManagement>
</project>
`,
upgrade: { upgrade: {
updateType: 'replacement', updateType: 'replacement',
depName: 'org.example:foo', depName: 'org.example:foo',
currentValue: '0.0.1', currentValue: '0.0.1',
fileReplacePosition: 829, fileReplacePosition: 132,
newName: 'org.example.new:bar', newName: 'org.example.new:bar',
newValue: '0.0.1', newValue: '0.0.1',
}, },