Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(migrations): upgradeInRange (#13734)
* feat(migrations): upgradeInRange * feat(migrations): add test case Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
- Loading branch information
1 parent
f8124bd
commit 34f4901
Showing
4 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/config/migrations/custom/upgrade-in-range-migration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { UpgradeInRangeMigration } from './upgrade-in-range-migration'; | ||
|
||
describe('config/migrations/custom/upgrade-in-range-migration', () => { | ||
it('should migrate upgradeInRange=true to rangeStrategy="bump"', () => { | ||
expect(UpgradeInRangeMigration).toMigrate( | ||
{ | ||
upgradeInRange: true, | ||
}, | ||
{ | ||
rangeStrategy: 'bump', | ||
} | ||
); | ||
}); | ||
|
||
it('should just remove property when upgradeInRange not equals to true', () => { | ||
expect(UpgradeInRangeMigration).toMigrate( | ||
{ | ||
upgradeInRange: false, | ||
}, | ||
{} | ||
); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
lib/config/migrations/custom/upgrade-in-range-migration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractMigration } from '../base/abstract-migration'; | ||
|
||
export class UpgradeInRangeMigration extends AbstractMigration { | ||
override readonly deprecated = true; | ||
readonly propertyName = 'upgradeInRange'; | ||
|
||
override run(value): void { | ||
if (value === true) { | ||
this.setSafely('rangeStrategy', 'bump'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters