Skip to content

Commit

Permalink
fix(sbt): Fix module re-export (#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Feb 7, 2020
1 parent 3e9dec4 commit 0b61cfc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/manager/sbt/update.spec.ts
Expand Up @@ -13,17 +13,17 @@ describe('lib/manager/sbt/extract', () => {
const { deps } = extractPackageFile(fileContent);
const upgrade: Upgrade = deps.shift();
upgrade.newValue = upgrade.currentValue;
const newFileContent = updateDependency(fileContent, upgrade);
const newFileContent = updateDependency({ fileContent, upgrade });
expect(newFileContent).toBe(fileContent);
});
it('returns null if content has been updated somewhere', () => {
const { deps } = extractPackageFile(fileContent);
const upgrade: Upgrade = deps.shift();
upgrade.newValue = '0.1.1';
const newFileContent = updateDependency(
fileContent.replace('0.0.1', '0.1.0'),
upgrade
);
const newFileContent = updateDependency({
fileContent: fileContent.replace('0.0.1', '0.1.0'),
upgrade,
});
expect(newFileContent).toBeNull();
});
it('updates old deps to newer ones', () => {
Expand All @@ -38,7 +38,7 @@ describe('lib/manager/sbt/extract', () => {
});
upgrades.forEach(upgrade => {
const { currentValue, newValue } = upgrade;
const newFileContent = updateDependency(fileContent, upgrade);
const newFileContent = updateDependency({ fileContent, upgrade });
const cmpContent = fileContent.replace(currentValue, newValue);
expect(newFileContent).toEqual(cmpContent);
});
Expand Down
10 changes: 9 additions & 1 deletion lib/manager/sbt/update.ts
@@ -1 +1,9 @@
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 comments on commit 0b61cfc

Please sign in to comment.