Refactor to use version object #59
Enable writing safer version aware logic.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export function getProcessEnvironmentStub(): NodeJS.ProcessEnv {
|
||||
return {
|
||||
VUE_APP_VERSION: 'stub-version',
|
||||
VUE_APP_VERSION: '0.11.3',
|
||||
VUE_APP_NAME: 'stub-name',
|
||||
VUE_APP_REPOSITORY_URL: 'stub-repository-url',
|
||||
VUE_APP_HOMEPAGE_URL: 'stub-homepage-url',
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
||||
import { Version } from '@/domain/Version';
|
||||
import { VersionStub } from './VersionStub';
|
||||
|
||||
export class ProjectInformationStub implements IProjectInformation {
|
||||
public name = 'name';
|
||||
|
||||
public version = 'version';
|
||||
public version = new VersionStub();
|
||||
|
||||
public repositoryUrl = 'repositoryUrl';
|
||||
|
||||
@@ -22,7 +24,7 @@ export class ProjectInformationStub implements IProjectInformation {
|
||||
return this;
|
||||
}
|
||||
|
||||
public withVersion(version: string): ProjectInformationStub {
|
||||
public withVersion(version: Version): ProjectInformationStub {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
7
tests/unit/shared/Stubs/VersionStub.ts
Normal file
7
tests/unit/shared/Stubs/VersionStub.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Version } from '@/domain/Version';
|
||||
|
||||
export class VersionStub extends Version {
|
||||
constructor(version?: string) {
|
||||
super(version ?? '0.10.0');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user