0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/modules/manager/sbt/update.spec.ts
2023-11-07 15:50:29 +00:00

52 lines
1.2 KiB
TypeScript

import * as sbtUpdater from '.';
describe('modules/manager/sbt/update', () => {
describe('.bumpPackageVersion()', () => {
const content =
'name := "test"\n' +
'organization := "test-org"\n' +
'version := "0.0.2"\n';
it('increments', () => {
const { bumpedContent } = sbtUpdater.bumpPackageVersion(
content,
'0.0.2',
'patch',
);
expect(bumpedContent).toEqual(content.replace('0.0.2', '0.0.3'));
expect(bumpedContent).not.toEqual(content);
});
it('no ops', () => {
const { bumpedContent } = sbtUpdater.bumpPackageVersion(
content,
'0.0.1',
'patch',
);
expect(bumpedContent).toEqual(content);
});
it('updates', () => {
const { bumpedContent } = sbtUpdater.bumpPackageVersion(
content,
'0.0.1',
'minor',
);
expect(bumpedContent).toEqual(content.replace('0.0.2', '0.1.0'));
expect(bumpedContent).not.toEqual(content);
});
it('returns content if bumping errors', () => {
const { bumpedContent } = sbtUpdater.bumpPackageVersion(
content,
'0.0.2',
true as any,
);
expect(bumpedContent).toEqual(content);
});
});
});