Skip to content

Commit

Permalink
Disable version for next prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
BuZZ-T committed Oct 20, 2021
1 parent 5d6d5b0 commit e5bf205
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 17 additions & 1 deletion commons/MappedVersion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IVersionWithDisabled } from '../interfaces/interfaces'
import { MappedVersion } from './MappedVersion'
import { MappedVersion } from './MappedVersion';
describe('MappedVersion', () => {
describe('string input', () => {
it('should create a MappedVersion with first input', () => {
Expand Down Expand Up @@ -94,4 +94,20 @@ describe('MappedVersion', () => {
it('should throw an error on unknwon input', () => {
expect(() => new MappedVersion(0 as unknown as IVersionWithDisabled)).toThrow('This should not happen, MappedVersion called with wrong types!')
})

it('should disable the version', () => {
const version = new MappedVersion({
major: 10,
minor: 0,
branch: 0,
patch: 0,
disabled: false
})

expect(version.disabled).toBe(false)

version.disable()

expect(version.disabled).toBe(true)
})
})
4 changes: 4 additions & 0 deletions commons/MappedVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export class MappedVersion {
return this._disabled
}

public disable(): void {
this._disabled = true
}

public constructor(input: string, disabled: boolean)
public constructor(major: number, minor: number, branch: number, patch: number, disabled: boolean)
public constructor(versionObject: IVersionWithDisabled)
Expand Down

0 comments on commit e5bf205

Please sign in to comment.