Skip to content
Snippets Groups Projects
Unverified Commit 0b61cfc1 authored by Sergio Zharinov's avatar Sergio Zharinov Committed by GitHub
Browse files

fix(sbt): Fix module re-export (#5404)

parent 3e9dec4f
No related branches found
No related tags found
No related merge requests found
...@@ -13,17 +13,17 @@ describe('lib/manager/sbt/extract', () => { ...@@ -13,17 +13,17 @@ describe('lib/manager/sbt/extract', () => {
const { deps } = extractPackageFile(fileContent); const { deps } = extractPackageFile(fileContent);
const upgrade: Upgrade = deps.shift(); const upgrade: Upgrade = deps.shift();
upgrade.newValue = upgrade.currentValue; upgrade.newValue = upgrade.currentValue;
const newFileContent = updateDependency(fileContent, upgrade); const newFileContent = updateDependency({ fileContent, upgrade });
expect(newFileContent).toBe(fileContent); expect(newFileContent).toBe(fileContent);
}); });
it('returns null if content has been updated somewhere', () => { it('returns null if content has been updated somewhere', () => {
const { deps } = extractPackageFile(fileContent); const { deps } = extractPackageFile(fileContent);
const upgrade: Upgrade = deps.shift(); const upgrade: Upgrade = deps.shift();
upgrade.newValue = '0.1.1'; upgrade.newValue = '0.1.1';
const newFileContent = updateDependency( const newFileContent = updateDependency({
fileContent.replace('0.0.1', '0.1.0'), fileContent: fileContent.replace('0.0.1', '0.1.0'),
upgrade upgrade,
); });
expect(newFileContent).toBeNull(); expect(newFileContent).toBeNull();
}); });
it('updates old deps to newer ones', () => { it('updates old deps to newer ones', () => {
...@@ -38,7 +38,7 @@ describe('lib/manager/sbt/extract', () => { ...@@ -38,7 +38,7 @@ describe('lib/manager/sbt/extract', () => {
}); });
upgrades.forEach(upgrade => { upgrades.forEach(upgrade => {
const { currentValue, newValue } = upgrade; const { currentValue, newValue } = upgrade;
const newFileContent = updateDependency(fileContent, upgrade); const newFileContent = updateDependency({ fileContent, upgrade });
const cmpContent = fileContent.replace(currentValue, newValue); const cmpContent = fileContent.replace(currentValue, newValue);
expect(newFileContent).toEqual(cmpContent); expect(newFileContent).toEqual(cmpContent);
}); });
......
export { updateAtPosition as updateDependency } from '../maven/update'; import { UpdateDependencyConfig } from '../common';
import { updateAtPosition } from '../maven/update';
export function updateDependency({
fileContent,
upgrade,
}: UpdateDependencyConfig): string | null {
return updateAtPosition(fileContent, upgrade);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment