Change slogan and refactor project info naming
The project's slagon has been updated back to "Privacy is sexy" from "Now you have the choice" for enhanced brand clarity and memorability. This change also reflects the community's preference and aligns with the project's established identity. This commit also refactors naming and structure of project information (metadata) struct to enhance clarity and maintainability in relation to changing the slogan. Key changes include: - Update UI components to display the revised slogan. - Remove period from project slogan in code area for consistency with a explanatory comment for future maintainability. - Refactor header container and class names for clarity. - Standardize project metadata usage in `TheCodeArea.vue` to ensure consistency. - Improve code clarity by renaming `IProjectInformation` to `ProjectDetails` and `ProjectInformation` to `GitHubProjectDetails`. - Organize `ProjectDetails` under a dedicated `Project` directory within the domain layer for better structure. These changes are expected to improve the project's appeal and streamline future maintenance and development efforts.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# privacy.sexy — Now you have the choice
|
# privacy.sexy — Privacy is sexy
|
||||||
|
|
||||||
> Enforce privacy & security best-practices on Windows, macOS and Linux, because privacy is sexy.
|
> Enforce privacy & security best-practices on Windows, macOS and Linux, because privacy is sexy.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "privacy.sexy",
|
"name": "privacy.sexy",
|
||||||
"version": "0.12.10",
|
"version": "0.12.10",
|
||||||
"private": true,
|
"private": true,
|
||||||
"slogan": "Now you have the choice",
|
"slogan": "Privacy is sexy",
|
||||||
"description": "Enforce privacy & security best-practices on Windows, macOS and Linux, because privacy is sexy.",
|
"description": "Enforce privacy & security best-practices on Windows, macOS and Linux, because privacy is sexy.",
|
||||||
"author": "undergroundwires",
|
"author": "undergroundwires",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { CollectionData } from '@/application/collections/';
|
import type { CollectionData } from '@/application/collections/';
|
||||||
import { IApplication } from '@/domain/IApplication';
|
import { IApplication } from '@/domain/IApplication';
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||||
import WindowsData from '@/application/collections/windows.yaml';
|
import WindowsData from '@/application/collections/windows.yaml';
|
||||||
import MacOsData from '@/application/collections/macos.yaml';
|
import MacOsData from '@/application/collections/macos.yaml';
|
||||||
import LinuxData from '@/application/collections/linux.yaml';
|
import LinuxData from '@/application/collections/linux.yaml';
|
||||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
import { parseProjectDetails } from '@/application/Parser/ProjectDetailsParser';
|
||||||
import { Application } from '@/domain/Application';
|
import { Application } from '@/domain/Application';
|
||||||
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
||||||
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
||||||
@@ -13,19 +13,21 @@ import { parseCategoryCollection } from './CategoryCollectionParser';
|
|||||||
|
|
||||||
export function parseApplication(
|
export function parseApplication(
|
||||||
categoryParser = parseCategoryCollection,
|
categoryParser = parseCategoryCollection,
|
||||||
informationParser = parseProjectInformation,
|
projectDetailsParser = parseProjectDetails,
|
||||||
metadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance,
|
metadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance,
|
||||||
collectionsData = PreParsedCollections,
|
collectionsData = PreParsedCollections,
|
||||||
): IApplication {
|
): IApplication {
|
||||||
validateCollectionsData(collectionsData);
|
validateCollectionsData(collectionsData);
|
||||||
const information = informationParser(metadata);
|
const projectDetails = projectDetailsParser(metadata);
|
||||||
const collections = collectionsData.map((collection) => categoryParser(collection, information));
|
const collections = collectionsData.map(
|
||||||
const app = new Application(information, collections);
|
(collection) => categoryParser(collection, projectDetails),
|
||||||
|
);
|
||||||
|
const app = new Application(projectDetails, collections);
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CategoryCollectionParserType
|
export type CategoryCollectionParserType
|
||||||
= (file: CollectionData, info: IProjectInformation) => ICategoryCollection;
|
= (file: CollectionData, projectDetails: ProjectDetails) => ICategoryCollection;
|
||||||
|
|
||||||
const PreParsedCollections: readonly CollectionData [] = [
|
const PreParsedCollections: readonly CollectionData [] = [
|
||||||
WindowsData, MacOsData, LinuxData,
|
WindowsData, MacOsData, LinuxData,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { CollectionData } from '@/application/collections/';
|
|||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||||
import { CategoryCollection } from '@/domain/CategoryCollection';
|
import { CategoryCollection } from '@/domain/CategoryCollection';
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { createEnumParser } from '../Common/Enum';
|
import { createEnumParser } from '../Common/Enum';
|
||||||
import { parseCategory } from './CategoryParser';
|
import { parseCategory } from './CategoryParser';
|
||||||
import { CategoryCollectionParseContext } from './Script/CategoryCollectionParseContext';
|
import { CategoryCollectionParseContext } from './Script/CategoryCollectionParseContext';
|
||||||
@@ -10,12 +10,12 @@ import { ScriptingDefinitionParser } from './ScriptingDefinition/ScriptingDefini
|
|||||||
|
|
||||||
export function parseCategoryCollection(
|
export function parseCategoryCollection(
|
||||||
content: CollectionData,
|
content: CollectionData,
|
||||||
info: IProjectInformation,
|
projectDetails: ProjectDetails,
|
||||||
osParser = createEnumParser(OperatingSystem),
|
osParser = createEnumParser(OperatingSystem),
|
||||||
): ICategoryCollection {
|
): ICategoryCollection {
|
||||||
validate(content);
|
validate(content);
|
||||||
const scripting = new ScriptingDefinitionParser()
|
const scripting = new ScriptingDefinitionParser()
|
||||||
.parse(content.scripting, info);
|
.parse(content.scripting, projectDetails);
|
||||||
const context = new CategoryCollectionParseContext(content.functions, scripting);
|
const context = new CategoryCollectionParseContext(content.functions, scripting);
|
||||||
const categories = content.actions.map((action) => parseCategory(action, context));
|
const categories = content.actions.map((action) => parseCategory(action, context));
|
||||||
const os = osParser.parseEnum(content.os, 'os');
|
const os = osParser.parseEnum(content.os, 'os');
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { ProjectInformation } from '@/domain/ProjectInformation';
|
import { GitHubProjectDetails } from '@/domain/Project/GitHubProjectDetails';
|
||||||
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
||||||
import { Version } from '@/domain/Version';
|
import { Version } from '@/domain/Version';
|
||||||
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
||||||
import { ConstructorArguments } from '@/TypeHelpers';
|
import { ConstructorArguments } from '@/TypeHelpers';
|
||||||
|
|
||||||
export function
|
export function
|
||||||
parseProjectInformation(
|
parseProjectDetails(
|
||||||
metadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance,
|
metadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance,
|
||||||
createProjectInformation: ProjectInformationFactory = (
|
createProjectDetails: ProjectDetailsFactory = (
|
||||||
...args
|
...args
|
||||||
) => new ProjectInformation(...args),
|
) => new GitHubProjectDetails(...args),
|
||||||
): IProjectInformation {
|
): ProjectDetails {
|
||||||
const version = new Version(
|
const version = new Version(
|
||||||
metadata.version,
|
metadata.version,
|
||||||
);
|
);
|
||||||
return createProjectInformation(
|
return createProjectDetails(
|
||||||
metadata.name,
|
metadata.name,
|
||||||
version,
|
version,
|
||||||
metadata.slogan,
|
metadata.slogan,
|
||||||
@@ -24,6 +24,6 @@ parseProjectInformation(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProjectInformationFactory = (
|
export type ProjectDetailsFactory = (
|
||||||
...args: ConstructorArguments<typeof ProjectInformation>
|
...args: ConstructorArguments<typeof GitHubProjectDetails>
|
||||||
) => IProjectInformation;
|
) => ProjectDetails;
|
||||||
@@ -2,7 +2,7 @@ import { IExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expre
|
|||||||
import { ParameterSubstitutionParser } from '@/application/Parser/Script/Compiler/Expressions/SyntaxParsers/ParameterSubstitutionParser';
|
import { ParameterSubstitutionParser } from '@/application/Parser/Script/Compiler/Expressions/SyntaxParsers/ParameterSubstitutionParser';
|
||||||
import { CompositeExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/CompositeExpressionParser';
|
import { CompositeExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/CompositeExpressionParser';
|
||||||
import { ExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/ExpressionsCompiler';
|
import { ExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/ExpressionsCompiler';
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { FunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgumentCollection';
|
import { FunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgumentCollection';
|
||||||
import { FunctionCallArgument } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgument';
|
import { FunctionCallArgument } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgument';
|
||||||
import { ICodeSubstituter } from './ICodeSubstituter';
|
import { ICodeSubstituter } from './ICodeSubstituter';
|
||||||
@@ -15,13 +15,13 @@ export class CodeSubstituter implements ICodeSubstituter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public substitute(code: string, info: IProjectInformation): string {
|
public substitute(code: string, projectDetails: ProjectDetails): string {
|
||||||
if (!code) { throw new Error('missing code'); }
|
if (!code) { throw new Error('missing code'); }
|
||||||
const args = new FunctionCallArgumentCollection();
|
const args = new FunctionCallArgumentCollection();
|
||||||
const substitute = (name: string, value: string) => args
|
const substitute = (name: string, value: string) => args
|
||||||
.addArgument(new FunctionCallArgument(name, value));
|
.addArgument(new FunctionCallArgument(name, value));
|
||||||
substitute('homepage', info.homepage);
|
substitute('homepage', projectDetails.homepage);
|
||||||
substitute('version', info.version.toString());
|
substitute('version', projectDetails.version.toString());
|
||||||
substitute('date', this.date.toUTCString());
|
substitute('date', this.date.toUTCString());
|
||||||
const compiledCode = this.compiler.compileExpressions(code, args);
|
const compiledCode = this.compiler.compileExpressions(code, args);
|
||||||
return compiledCode;
|
return compiledCode;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
|
|
||||||
export interface ICodeSubstituter {
|
export interface ICodeSubstituter {
|
||||||
substitute(code: string, info: IProjectInformation): string;
|
substitute(code: string, projectDetails: ProjectDetails): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { ScriptingDefinitionData } from '@/application/collections/';
|
|||||||
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
||||||
import { ScriptingDefinition } from '@/domain/ScriptingDefinition';
|
import { ScriptingDefinition } from '@/domain/ScriptingDefinition';
|
||||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { createEnumParser } from '../../Common/Enum';
|
import { createEnumParser } from '../../Common/Enum';
|
||||||
import { ICodeSubstituter } from './ICodeSubstituter';
|
import { ICodeSubstituter } from './ICodeSubstituter';
|
||||||
import { CodeSubstituter } from './CodeSubstituter';
|
import { CodeSubstituter } from './CodeSubstituter';
|
||||||
@@ -16,11 +16,11 @@ export class ScriptingDefinitionParser {
|
|||||||
|
|
||||||
public parse(
|
public parse(
|
||||||
definition: ScriptingDefinitionData,
|
definition: ScriptingDefinitionData,
|
||||||
info: IProjectInformation,
|
projectDetails: ProjectDetails,
|
||||||
): IScriptingDefinition {
|
): IScriptingDefinition {
|
||||||
const language = this.languageParser.parseEnum(definition.language, 'language');
|
const language = this.languageParser.parseEnum(definition.language, 'language');
|
||||||
const startCode = this.codeSubstituter.substitute(definition.startCode, info);
|
const startCode = this.codeSubstituter.substitute(definition.startCode, projectDetails);
|
||||||
const endCode = this.codeSubstituter.substitute(definition.endCode, info);
|
const endCode = this.codeSubstituter.substitute(definition.endCode, projectDetails);
|
||||||
return new ScriptingDefinition(
|
return new ScriptingDefinition(
|
||||||
language,
|
language,
|
||||||
startCode,
|
startCode,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { IApplication } from './IApplication';
|
import { IApplication } from './IApplication';
|
||||||
import { ICategoryCollection } from './ICategoryCollection';
|
import { ICategoryCollection } from './ICategoryCollection';
|
||||||
import { IProjectInformation } from './IProjectInformation';
|
import { ProjectDetails } from './Project/ProjectDetails';
|
||||||
import { OperatingSystem } from './OperatingSystem';
|
import { OperatingSystem } from './OperatingSystem';
|
||||||
|
|
||||||
export class Application implements IApplication {
|
export class Application implements IApplication {
|
||||||
constructor(
|
constructor(
|
||||||
public info: IProjectInformation,
|
public projectDetails: ProjectDetails,
|
||||||
public collections: readonly ICategoryCollection[],
|
public collections: readonly ICategoryCollection[],
|
||||||
) {
|
) {
|
||||||
validateCollections(collections);
|
validateCollections(collections);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ICategoryCollection } from './ICategoryCollection';
|
import { ICategoryCollection } from './ICategoryCollection';
|
||||||
import { IProjectInformation } from './IProjectInformation';
|
import { ProjectDetails } from './Project/ProjectDetails';
|
||||||
import { OperatingSystem } from './OperatingSystem';
|
import { OperatingSystem } from './OperatingSystem';
|
||||||
|
|
||||||
export interface IApplication {
|
export interface IApplication {
|
||||||
readonly info: IProjectInformation;
|
readonly projectDetails: ProjectDetails;
|
||||||
readonly collections: readonly ICategoryCollection[];
|
readonly collections: readonly ICategoryCollection[];
|
||||||
|
|
||||||
getSupportedOsList(): OperatingSystem[];
|
getSupportedOsList(): OperatingSystem[];
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { assertInRange } from '@/application/Common/Enum';
|
import { assertInRange } from '@/application/Common/Enum';
|
||||||
import { IProjectInformation } from './IProjectInformation';
|
import { OperatingSystem } from '../OperatingSystem';
|
||||||
import { OperatingSystem } from './OperatingSystem';
|
import { Version } from '../Version';
|
||||||
import { Version } from './Version';
|
import type { ProjectDetails } from './ProjectDetails';
|
||||||
|
|
||||||
export class ProjectInformation implements IProjectInformation {
|
export class GitHubProjectDetails implements ProjectDetails {
|
||||||
public readonly repositoryWebUrl: string;
|
public readonly repositoryWebUrl: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { Version } from '@/domain/Version';
|
import { Version } from '@/domain/Version';
|
||||||
|
|
||||||
export interface IProjectInformation {
|
export interface ProjectDetails {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly version: Version;
|
readonly version: Version;
|
||||||
|
|
||||||
@@ -44,14 +44,14 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const { currentState } = injectKey((keys) => keys.useCollectionState);
|
const { currentState } = injectKey((keys) => keys.useCollectionState);
|
||||||
|
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
|
|
||||||
const operatingSystem = computed<OperatingSystem>(() => currentState.value.os);
|
const operatingSystem = computed<OperatingSystem>(() => currentState.value.os);
|
||||||
|
|
||||||
const appName = computed<string>(() => info.name);
|
const appName = computed<string>(() => projectDetails.name);
|
||||||
|
|
||||||
const downloadUrl = computed<string>(
|
const downloadUrl = computed<string>(
|
||||||
() => info.getDownloadUrl(operatingSystem.value),
|
() => projectDetails.getDownloadUrl(operatingSystem.value),
|
||||||
);
|
);
|
||||||
|
|
||||||
const osName = computed<string>(
|
const osName = computed<string>(
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { IReadOnlyCategoryCollectionState } from '@/application/Context/State/IC
|
|||||||
import { CodeBuilderFactory } from '@/application/Context/State/Code/Generation/CodeBuilderFactory';
|
import { CodeBuilderFactory } from '@/application/Context/State/Code/Generation/CodeBuilderFactory';
|
||||||
import SizeObserver from '@/presentation/components/Shared/SizeObserver.vue';
|
import SizeObserver from '@/presentation/components/Shared/SizeObserver.vue';
|
||||||
import { NonCollapsing } from '@/presentation/components/Scripts/View/Cards/NonCollapsingDirective';
|
import { NonCollapsing } from '@/presentation/components/Scripts/View/Cards/NonCollapsingDirective';
|
||||||
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import ace from './ace-importer';
|
import ace from './ace-importer';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -41,6 +42,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { onStateChange, currentState } = injectKey((keys) => keys.useCollectionState);
|
const { onStateChange, currentState } = injectKey((keys) => keys.useCollectionState);
|
||||||
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
const { events } = injectKey((keys) => keys.useAutoUnsubscribedEvents);
|
const { events } = injectKey((keys) => keys.useAutoUnsubscribedEvents);
|
||||||
|
|
||||||
const editorId = 'codeEditor';
|
const editorId = 'codeEditor';
|
||||||
@@ -74,7 +76,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateCode(code: string, language: ScriptingLanguage) {
|
function updateCode(code: string, language: ScriptingLanguage) {
|
||||||
const innerCode = code || getDefaultCode(language);
|
const innerCode = code || getDefaultCode(language, projectDetails);
|
||||||
editor?.setValue(innerCode, 1);
|
editor?.setValue(innerCode, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,10 +173,14 @@ function getLanguage(language: ScriptingLanguage) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultCode(language: ScriptingLanguage): string {
|
function getDefaultCode(language: ScriptingLanguage, project: ProjectDetails): string {
|
||||||
return new CodeBuilderFactory()
|
return new CodeBuilderFactory()
|
||||||
.create(language)
|
.create(language)
|
||||||
.appendCommentLine('privacy.sexy — Now you have the choice.')
|
.appendCommentLine(`${project.name} — ${project.slogan}`)
|
||||||
|
/*
|
||||||
|
Keep the slogan without a period for impact and continuity.
|
||||||
|
Slogans should be punchy and memorable, not punctuated like full sentences.
|
||||||
|
*/
|
||||||
.appendCommentLine(' 🔐 Enforce privacy & security best-practices on Windows, macOS and Linux.')
|
.appendCommentLine(' 🔐 Enforce privacy & security best-practices on Windows, macOS and Linux.')
|
||||||
.appendLine()
|
.appendLine()
|
||||||
.appendCommentLine('-- 🤔 How to use')
|
.appendCommentLine('-- 🤔 How to use')
|
||||||
@@ -183,7 +189,7 @@ function getDefaultCode(language: ScriptingLanguage): string {
|
|||||||
.appendCommentLine(' 📙 After you choose any tweak, you can download or copy to execute your script.')
|
.appendCommentLine(' 📙 After you choose any tweak, you can download or copy to execute your script.')
|
||||||
.appendCommentLine(' 📙 Come back regularly to apply latest version for stronger privacy and security.')
|
.appendCommentLine(' 📙 Come back regularly to apply latest version for stronger privacy and security.')
|
||||||
.appendLine()
|
.appendLine()
|
||||||
.appendCommentLine('-- 🧐 Why privacy.sexy')
|
.appendCommentLine(`-- 🧐 Why ${project.name}`)
|
||||||
.appendCommentLine(' ✔️ Rich tweak pool to harden security & privacy of the OS and other software on it.')
|
.appendCommentLine(' ✔️ Rich tweak pool to harden security & privacy of the OS and other software on it.')
|
||||||
.appendCommentLine(' ✔️ No need to run any compiled software on your system, just run the generated scripts.')
|
.appendCommentLine(' ✔️ No need to run any compiled software on your system, just run the generated scripts.')
|
||||||
.appendCommentLine(' ✔️ Have full visibility into what the tweaks do as you enable them.')
|
.appendCommentLine(' ✔️ Have full visibility into what the tweaks do as you enable them.')
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const { modifyCurrentState, onStateChange } = injectKey((keys) => keys.useCollectionState);
|
const { modifyCurrentState, onStateChange } = injectKey((keys) => keys.useCollectionState);
|
||||||
const { events } = injectKey((keys) => keys.useAutoUnsubscribedEvents);
|
const { events } = injectKey((keys) => keys.useAutoUnsubscribedEvents);
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
|
|
||||||
const repositoryUrl = computed<string>(() => info.repositoryWebUrl);
|
const repositoryUrl = computed<string>(() => projectDetails.repositoryWebUrl);
|
||||||
const searchQuery = ref<string | undefined>();
|
const searchQuery = ref<string | undefined>();
|
||||||
const isSearching = computed(() => Boolean(searchQuery.value));
|
const isSearching = computed(() => Boolean(searchQuery.value));
|
||||||
const searchHasMatches = ref(false);
|
const searchHasMatches = ref(false);
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ import { IApplication } from '@/domain/IApplication';
|
|||||||
export function useApplication(application: IApplication) {
|
export function useApplication(application: IApplication) {
|
||||||
return {
|
return {
|
||||||
application,
|
application,
|
||||||
info: application.info,
|
projectDetails: application.projectDetails,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
const { os: currentOs } = injectKey((keys) => keys.useRuntimeEnvironment);
|
const { os: currentOs } = injectKey((keys) => keys.useRuntimeEnvironment);
|
||||||
|
|
||||||
const isCurrentOs = computed<boolean>(() => {
|
const isCurrentOs = computed<boolean>(() => {
|
||||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const downloadUrl = computed<string>(() => {
|
const downloadUrl = computed<string>(() => {
|
||||||
return info.getDownloadUrl(props.operatingSystem);
|
return projectDetails.getDownloadUrl(props.operatingSystem);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ import { injectKey } from '@/presentation/injectionSymbols';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
const { isRunningAsDesktopApplication } = injectKey((keys) => keys.useRuntimeEnvironment);
|
const { isRunningAsDesktopApplication } = injectKey((keys) => keys.useRuntimeEnvironment);
|
||||||
|
|
||||||
const repositoryUrl = computed<string>(() => info.repositoryUrl);
|
const repositoryUrl = computed<string>(() => projectDetails.repositoryUrl);
|
||||||
const feedbackUrl = computed<string>(() => info.feedbackUrl);
|
const feedbackUrl = computed<string>(() => projectDetails.feedbackUrl);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
|
|||||||
@@ -67,20 +67,20 @@ export default defineComponent({
|
|||||||
FlatButton,
|
FlatButton,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
const { isRunningAsDesktopApplication } = injectKey((keys) => keys.useRuntimeEnvironment);
|
const { isRunningAsDesktopApplication } = injectKey((keys) => keys.useRuntimeEnvironment);
|
||||||
|
|
||||||
const isPrivacyDialogVisible = ref(false);
|
const isPrivacyDialogVisible = ref(false);
|
||||||
|
|
||||||
const version = computed<string>(() => info.version.toString());
|
const version = computed<string>(() => projectDetails.version.toString());
|
||||||
|
|
||||||
const homepageUrl = computed<string>(() => info.homepage);
|
const homepageUrl = computed<string>(() => projectDetails.homepage);
|
||||||
|
|
||||||
const repositoryUrl = computed<string>(() => info.repositoryWebUrl);
|
const repositoryUrl = computed<string>(() => projectDetails.repositoryWebUrl);
|
||||||
|
|
||||||
const releaseUrl = computed<string>(() => info.releaseUrl);
|
const releaseUrl = computed<string>(() => projectDetails.releaseUrl);
|
||||||
|
|
||||||
const feedbackUrl = computed<string>(() => info.feedbackUrl);
|
const feedbackUrl = computed<string>(() => projectDetails.feedbackUrl);
|
||||||
|
|
||||||
function showPrivacyDialog() {
|
function showPrivacyDialog() {
|
||||||
isPrivacyDialogVisible.value = true;
|
isPrivacyDialogVisible.value = true;
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="container">
|
<div class="container">
|
||||||
<h1 class="child title">
|
<h1 class="child brand">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</h1>
|
</h1>
|
||||||
<h2 class="child subtitle">
|
<h2 class="child slogan">
|
||||||
|
<!--
|
||||||
|
Keep the slogan without a period for impact and continuity.
|
||||||
|
Slogans should be punchy and memorable, not punctuated like full sentences.
|
||||||
|
-->
|
||||||
{{ subtitle }}
|
{{ subtitle }}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,10 +19,10 @@ import { injectKey } from '@/presentation/injectionSymbols';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const { info } = injectKey((keys) => keys.useApplication);
|
const { projectDetails } = injectKey((keys) => keys.useApplication);
|
||||||
|
|
||||||
const title = computed(() => info.name);
|
const title = computed(() => projectDetails.name);
|
||||||
const subtitle = computed(() => info.slogan);
|
const subtitle = computed(() => projectDetails.slogan);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
@@ -32,7 +36,7 @@ export default defineComponent({
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "@/presentation/assets/styles/main" as *;
|
@use "@/presentation/assets/styles/main" as *;
|
||||||
|
|
||||||
#container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -42,13 +46,13 @@ export default defineComponent({
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.brand {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-family: $font-main;
|
font-family: $font-main;
|
||||||
font-size: $font-size-absolute-xx-large;
|
font-size: $font-size-absolute-xx-large;
|
||||||
}
|
}
|
||||||
.subtitle {
|
.slogan {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: $font-size-absolute-x-large;
|
font-size: $font-size-absolute-x-large;
|
||||||
color: $color-primary;
|
color: $color-primary;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
import { UpdateInfo } from 'electron-updater';
|
import { UpdateInfo } from 'electron-updater';
|
||||||
import { ElectronLogger } from '@/infrastructure/Log/ElectronLogger';
|
import { ElectronLogger } from '@/infrastructure/Log/ElectronLogger';
|
||||||
import { ProjectInformation } from '@/domain/ProjectInformation';
|
import { GitHubProjectDetails } from '@/domain/Project/GitHubProjectDetails';
|
||||||
import { Version } from '@/domain/Version';
|
import { Version } from '@/domain/Version';
|
||||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
import { parseProjectDetails } from '@/application/Parser/ProjectDetailsParser';
|
||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { UpdateProgressBar } from '../UpdateProgressBar';
|
import { UpdateProgressBar } from '../UpdateProgressBar';
|
||||||
import {
|
import {
|
||||||
@@ -139,8 +139,8 @@ interface UpdateUrls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRemoteUpdateUrls(targetVersion: string): UpdateUrls {
|
function getRemoteUpdateUrls(targetVersion: string): UpdateUrls {
|
||||||
const existingProject = parseProjectInformation();
|
const existingProject = parseProjectDetails();
|
||||||
const targetProject = new ProjectInformation(
|
const targetProject = new GitHubProjectDetails(
|
||||||
existingProject.name,
|
existingProject.name,
|
||||||
new Version(targetVersion),
|
new Version(targetVersion),
|
||||||
existingProject.slogan,
|
existingProject.slogan,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const requestOptions: IBatchRequestOptions = {
|
|||||||
requestOptions: {
|
requestOptions: {
|
||||||
retryExponentialBaseInMs: 3 /* sec */ * 1000,
|
retryExponentialBaseInMs: 3 /* sec */ * 1000,
|
||||||
requestTimeoutInMs: 60 /* sec */ * 1000,
|
requestTimeoutInMs: 60 /* sec */ * 1000,
|
||||||
additionalHeaders: { referer: app.info.homepage },
|
additionalHeaders: { referer: app.projectDetails.homepage },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const testTimeoutInMs = urls.length * 60 /* seconds */ * 1000;
|
const testTimeoutInMs = urls.length * 60 /* seconds */ * 1000;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import type { CollectionData } from '@/application/collections/';
|
import type { CollectionData } from '@/application/collections/';
|
||||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
import { parseProjectDetails } from '@/application/Parser/ProjectDetailsParser';
|
||||||
import { CategoryCollectionParserType, parseApplication } from '@/application/Parser/ApplicationParser';
|
import { CategoryCollectionParserType, parseApplication } from '@/application/Parser/ApplicationParser';
|
||||||
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
||||||
import WindowsData from '@/application/collections/windows.yaml';
|
import WindowsData from '@/application/collections/windows.yaml';
|
||||||
@@ -13,8 +13,8 @@ import { getAbsentCollectionTestCases } from '@tests/unit/shared/TestCases/Absen
|
|||||||
import { AppMetadataStub } from '@tests/unit/shared/Stubs/AppMetadataStub';
|
import { AppMetadataStub } from '@tests/unit/shared/Stubs/AppMetadataStub';
|
||||||
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
import { EnvironmentVariablesFactory } from '@/infrastructure/EnvironmentVariables/EnvironmentVariablesFactory';
|
||||||
import { CategoryCollectionParserStub } from '@tests/unit/shared/Stubs/CategoryCollectionParserStub';
|
import { CategoryCollectionParserStub } from '@tests/unit/shared/Stubs/CategoryCollectionParserStub';
|
||||||
import { ProjectInformationParserStub } from '@tests/unit/shared/Stubs/ProjectInformationParserStub';
|
import { ProjectDetailsParserStub } from '@tests/unit/shared/Stubs/ProjectDetailsParserStub';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
|
|
||||||
describe('ApplicationParser', () => {
|
describe('ApplicationParser', () => {
|
||||||
describe('parseApplication', () => {
|
describe('parseApplication', () => {
|
||||||
@@ -38,63 +38,65 @@ describe('ApplicationParser', () => {
|
|||||||
expect(expected).to.equal(actual);
|
expect(expected).to.equal(actual);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('project information', () => {
|
describe('projectDetails', () => {
|
||||||
it('informationParser is used to create application info', () => {
|
it('projectDetailsParser is used to create the instance', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedInformation = new ProjectInformationStub();
|
const expectedProjectDetails = new ProjectDetailsStub();
|
||||||
const informationParserStub = new ProjectInformationParserStub()
|
const projectDetailsParserStub = new ProjectDetailsParserStub()
|
||||||
.withReturnValue(expectedInformation);
|
.withReturnValue(expectedProjectDetails);
|
||||||
const sut = new ApplicationParserBuilder()
|
const sut = new ApplicationParserBuilder()
|
||||||
.withProjectInformationParser(informationParserStub.getStub());
|
.withProjectDetailsParser(projectDetailsParserStub.getStub());
|
||||||
// act
|
// act
|
||||||
const app = sut.parseApplication();
|
const app = sut.parseApplication();
|
||||||
// assert
|
// assert
|
||||||
const actualInformation = app.info;
|
const actualProjectDetails = app.projectDetails;
|
||||||
expect(expectedInformation).to.deep.equal(actualInformation);
|
expect(expectedProjectDetails).to.deep.equal(actualProjectDetails);
|
||||||
});
|
});
|
||||||
it('informationParser is used to parse collection info', () => {
|
it('projectDetailsParser is used to parse collection', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedInformation = new ProjectInformationStub();
|
const expectedProjectDetails = new ProjectDetailsStub();
|
||||||
const informationParserStub = new ProjectInformationParserStub()
|
const projectDetailsParserStub = new ProjectDetailsParserStub()
|
||||||
.withReturnValue(expectedInformation);
|
.withReturnValue(expectedProjectDetails);
|
||||||
const collectionParserStub = new CategoryCollectionParserStub();
|
const collectionParserStub = new CategoryCollectionParserStub();
|
||||||
const sut = new ApplicationParserBuilder()
|
const sut = new ApplicationParserBuilder()
|
||||||
.withProjectInformationParser(informationParserStub.getStub())
|
.withProjectDetailsParser(projectDetailsParserStub.getStub())
|
||||||
.withCategoryCollectionParser(collectionParserStub.getStub());
|
.withCategoryCollectionParser(collectionParserStub.getStub());
|
||||||
// act
|
// act
|
||||||
sut.parseApplication();
|
sut.parseApplication();
|
||||||
// assert
|
// assert
|
||||||
expect(collectionParserStub.arguments).to.have.length.above(0);
|
expect(collectionParserStub.arguments).to.have.length.above(0);
|
||||||
const actuallyUsedInfos = collectionParserStub.arguments.map((arg) => arg.info);
|
const actuallyUsedInfos = collectionParserStub.arguments.map((arg) => arg.projectDetails);
|
||||||
expect(actuallyUsedInfos.every((info) => info === expectedInformation));
|
expect(actuallyUsedInfos.every(
|
||||||
|
(actualProjectDetails) => actualProjectDetails === expectedProjectDetails,
|
||||||
|
)).to.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('metadata', () => {
|
describe('metadata', () => {
|
||||||
it('used to parse expected metadata', () => {
|
it('used to parse expected metadata', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedMetadata = new AppMetadataStub();
|
const expectedMetadata = new AppMetadataStub();
|
||||||
const infoParserStub = new ProjectInformationParserStub();
|
const projectDetailsParser = new ProjectDetailsParserStub();
|
||||||
// act
|
// act
|
||||||
new ApplicationParserBuilder()
|
new ApplicationParserBuilder()
|
||||||
.withMetadata(expectedMetadata)
|
.withMetadata(expectedMetadata)
|
||||||
.withProjectInformationParser(infoParserStub.getStub())
|
.withProjectDetailsParser(projectDetailsParser.getStub())
|
||||||
.parseApplication();
|
.parseApplication();
|
||||||
// assert
|
// assert
|
||||||
expect(infoParserStub.arguments).to.have.lengthOf(1);
|
expect(projectDetailsParser.arguments).to.have.lengthOf(1);
|
||||||
expect(infoParserStub.arguments[0]).to.equal(expectedMetadata);
|
expect(projectDetailsParser.arguments[0]).to.equal(expectedMetadata);
|
||||||
});
|
});
|
||||||
it('defaults to metadata from factory', () => {
|
it('defaults to metadata from factory', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedMetadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance;
|
const expectedMetadata: IAppMetadata = EnvironmentVariablesFactory.Current.instance;
|
||||||
const infoParserStub = new ProjectInformationParserStub();
|
const projectDetailsParser = new ProjectDetailsParserStub();
|
||||||
// act
|
// act
|
||||||
new ApplicationParserBuilder()
|
new ApplicationParserBuilder()
|
||||||
.withMetadata(undefined) // force using default
|
.withMetadata(undefined) // force using default
|
||||||
.withProjectInformationParser(infoParserStub.getStub())
|
.withProjectDetailsParser(projectDetailsParser.getStub())
|
||||||
.parseApplication();
|
.parseApplication();
|
||||||
// assert
|
// assert
|
||||||
expect(infoParserStub.arguments).to.have.lengthOf(1);
|
expect(projectDetailsParser.arguments).to.have.lengthOf(1);
|
||||||
expect(infoParserStub.arguments[0]).to.equal(expectedMetadata);
|
expect(projectDetailsParser.arguments[0]).to.equal(expectedMetadata);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('collectionsData', () => {
|
describe('collectionsData', () => {
|
||||||
@@ -182,8 +184,8 @@ class ApplicationParserBuilder {
|
|||||||
private categoryCollectionParser
|
private categoryCollectionParser
|
||||||
: CategoryCollectionParserType = new CategoryCollectionParserStub().getStub();
|
: CategoryCollectionParserType = new CategoryCollectionParserStub().getStub();
|
||||||
|
|
||||||
private projectInformationParser
|
private projectDetailsParser
|
||||||
: typeof parseProjectInformation = new ProjectInformationParserStub().getStub();
|
: typeof parseProjectDetails = new ProjectDetailsParserStub().getStub();
|
||||||
|
|
||||||
private metadata: IAppMetadata | undefined = new AppMetadataStub();
|
private metadata: IAppMetadata | undefined = new AppMetadataStub();
|
||||||
|
|
||||||
@@ -196,10 +198,10 @@ class ApplicationParserBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withProjectInformationParser(
|
public withProjectDetailsParser(
|
||||||
projectInformationParser: typeof parseProjectInformation,
|
projectDetailsParser: typeof parseProjectDetails,
|
||||||
): this {
|
): this {
|
||||||
this.projectInformationParser = projectInformationParser;
|
this.projectDetailsParser = projectDetailsParser;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +220,7 @@ class ApplicationParserBuilder {
|
|||||||
public parseApplication(): ReturnType<typeof parseApplication> {
|
public parseApplication(): ReturnType<typeof parseApplication> {
|
||||||
return parseApplication(
|
return parseApplication(
|
||||||
this.categoryCollectionParser,
|
this.categoryCollectionParser,
|
||||||
this.projectInformationParser,
|
this.projectDetailsParser,
|
||||||
this.metadata,
|
this.metadata,
|
||||||
this.collectionsData,
|
this.collectionsData,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { OperatingSystem } from '@/domain/OperatingSystem';
|
|||||||
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
||||||
import { ScriptingDefinitionParser } from '@/application/Parser/ScriptingDefinition/ScriptingDefinitionParser';
|
import { ScriptingDefinitionParser } from '@/application/Parser/ScriptingDefinition/ScriptingDefinitionParser';
|
||||||
import { EnumParserStub } from '@tests/unit/shared/Stubs/EnumParserStub';
|
import { EnumParserStub } from '@tests/unit/shared/Stubs/EnumParserStub';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
import { getCategoryStub, CollectionDataStub } from '@tests/unit/shared/Stubs/CollectionDataStub';
|
import { getCategoryStub, CollectionDataStub } from '@tests/unit/shared/Stubs/CollectionDataStub';
|
||||||
import { CategoryCollectionParseContextStub } from '@tests/unit/shared/Stubs/CategoryCollectionParseContextStub';
|
import { CategoryCollectionParseContextStub } from '@tests/unit/shared/Stubs/CategoryCollectionParseContextStub';
|
||||||
import { CategoryDataStub } from '@tests/unit/shared/Stubs/CategoryDataStub';
|
import { CategoryDataStub } from '@tests/unit/shared/Stubs/CategoryDataStub';
|
||||||
@@ -25,9 +25,9 @@ describe('CategoryCollectionParser', () => {
|
|||||||
const expectedError = 'content does not define any action';
|
const expectedError = 'content does not define any action';
|
||||||
const collection = new CollectionDataStub()
|
const collection = new CollectionDataStub()
|
||||||
.withActions(absentValue);
|
.withActions(absentValue);
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
// act
|
// act
|
||||||
const act = () => parseCategoryCollection(collection, info);
|
const act = () => parseCategoryCollection(collection, projectDetails);
|
||||||
// assert
|
// assert
|
||||||
expect(act).to.throw(expectedError);
|
expect(act).to.throw(expectedError);
|
||||||
}, { excludeUndefined: true, excludeNull: true });
|
}, { excludeUndefined: true, excludeNull: true });
|
||||||
@@ -39,9 +39,9 @@ describe('CategoryCollectionParser', () => {
|
|||||||
const expected = [parseCategory(actions[0], context), parseCategory(actions[1], context)];
|
const expected = [parseCategory(actions[0], context), parseCategory(actions[1], context)];
|
||||||
const collection = new CollectionDataStub()
|
const collection = new CollectionDataStub()
|
||||||
.withActions(actions);
|
.withActions(actions);
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
// act
|
// act
|
||||||
const actual = parseCategoryCollection(collection, info).actions;
|
const actual = parseCategoryCollection(collection, projectDetails).actions;
|
||||||
// assert
|
// assert
|
||||||
expect(excludingId(actual)).to.be.deep.equal(excludingId(expected));
|
expect(excludingId(actual)).to.be.deep.equal(excludingId(expected));
|
||||||
function excludingId<TId>(array: ReadonlyArray<IEntity<TId>>) {
|
function excludingId<TId>(array: ReadonlyArray<IEntity<TId>>) {
|
||||||
@@ -57,11 +57,11 @@ describe('CategoryCollectionParser', () => {
|
|||||||
it('parses scripting definition as expected', () => {
|
it('parses scripting definition as expected', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const collection = new CollectionDataStub();
|
const collection = new CollectionDataStub();
|
||||||
const information = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const expected = new ScriptingDefinitionParser()
|
const expected = new ScriptingDefinitionParser()
|
||||||
.parse(collection.scripting, information);
|
.parse(collection.scripting, projectDetails);
|
||||||
// act
|
// act
|
||||||
const actual = parseCategoryCollection(collection, information).scripting;
|
const actual = parseCategoryCollection(collection, projectDetails).scripting;
|
||||||
// assert
|
// assert
|
||||||
expect(expected).to.deep.equal(actual);
|
expect(expected).to.deep.equal(actual);
|
||||||
});
|
});
|
||||||
@@ -76,9 +76,9 @@ describe('CategoryCollectionParser', () => {
|
|||||||
.withOs(osText);
|
.withOs(osText);
|
||||||
const parserMock = new EnumParserStub<OperatingSystem>()
|
const parserMock = new EnumParserStub<OperatingSystem>()
|
||||||
.setup(expectedName, osText, expectedOs);
|
.setup(expectedName, osText, expectedOs);
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
// act
|
// act
|
||||||
const actual = parseCategoryCollection(collection, info, parserMock);
|
const actual = parseCategoryCollection(collection, projectDetails, parserMock);
|
||||||
// assert
|
// assert
|
||||||
expect(actual.os).to.equal(expectedOs);
|
expect(actual.os).to.equal(expectedOs);
|
||||||
});
|
});
|
||||||
@@ -106,9 +106,9 @@ describe('CategoryCollectionParser', () => {
|
|||||||
const collection = new CollectionDataStub()
|
const collection = new CollectionDataStub()
|
||||||
.withActions([category])
|
.withActions([category])
|
||||||
.withFunctions([func]);
|
.withFunctions([func]);
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
// act
|
// act
|
||||||
const actual = parseCategoryCollection(collection, info);
|
const actual = parseCategoryCollection(collection, projectDetails);
|
||||||
// assert
|
// assert
|
||||||
const actualScript = actual.getScript(scriptName);
|
const actualScript = actual.getScript(scriptName);
|
||||||
const actualCode = actualScript.code.execute;
|
const actualCode = actualScript.code.execute;
|
||||||
|
|||||||
@@ -1,85 +1,87 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { parseProjectInformation, ProjectInformationFactory } from '@/application/Parser/ProjectInformationParser';
|
import { parseProjectDetails, ProjectDetailsFactory } from '@/application/Parser/ProjectDetailsParser';
|
||||||
import { AppMetadataStub } from '@tests/unit/shared/Stubs/AppMetadataStub';
|
import { AppMetadataStub } from '@tests/unit/shared/Stubs/AppMetadataStub';
|
||||||
import { PropertyKeys } from '@/TypeHelpers';
|
import { PropertyKeys } from '@/TypeHelpers';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
import { Version } from '@/domain/Version';
|
import { Version } from '@/domain/Version';
|
||||||
|
|
||||||
describe('ProjectInformationParser', () => {
|
describe('ProjectDetailsParser', () => {
|
||||||
describe('parseProjectInformation', () => {
|
describe('parseProjectDetails', () => {
|
||||||
it('returns expected information', () => {
|
it('returns expected instance', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedInformation = new ProjectInformationStub();
|
const expectedInformation = new ProjectDetailsStub();
|
||||||
const factoryMock = () => expectedInformation;
|
const factoryMock = () => expectedInformation;
|
||||||
// act
|
// act
|
||||||
const actualInformation = parseProjectInformation(new AppMetadataStub(), factoryMock);
|
const actualInformation = parseProjectDetails(new AppMetadataStub(), factoryMock);
|
||||||
// assert
|
// assert
|
||||||
expect(expectedInformation).to.equal(actualInformation);
|
expect(expectedInformation).to.equal(actualInformation);
|
||||||
});
|
});
|
||||||
describe('default behavior does not throw', () => {
|
describe('default behavior does not throw', () => {
|
||||||
it('without metadataFactory', () => {
|
it('without metadata', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const metadataFactory = undefined;
|
const metadataFactory = undefined;
|
||||||
const informationFactory = new ProjectInformationFactoryStub().getStub();
|
const projectDetailsFactory = new ProjectDetailsFactoryStub().getStub();
|
||||||
// act
|
// act
|
||||||
const act = () => parseProjectInformation(metadataFactory, informationFactory);
|
const act = () => parseProjectDetails(metadataFactory, projectDetailsFactory);
|
||||||
// expectS
|
// expectS
|
||||||
expect(act).to.not.throw();
|
expect(act).to.not.throw();
|
||||||
});
|
});
|
||||||
it('without projectInformationFactory', () => {
|
it('without projectDetailsFactory', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const metadataFactory = new AppMetadataStub();
|
const metadataFactory = new AppMetadataStub();
|
||||||
const informationFactory = undefined;
|
const projectDetailsFactory = undefined;
|
||||||
// act
|
// act
|
||||||
const act = () => parseProjectInformation(metadataFactory, informationFactory);
|
const act = () => parseProjectDetails(metadataFactory, projectDetailsFactory);
|
||||||
// expect
|
// expect
|
||||||
expect(act).to.not.throw();
|
expect(act).to.not.throw();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('parses metadata to project information', () => {
|
describe('parses metadata correctly', () => {
|
||||||
interface IMetadataTestCase {
|
interface MetadataTestScenario {
|
||||||
readonly setMetadata: (appMetadataStub: AppMetadataStub, value: string) => AppMetadataStub;
|
readonly setMetadata: (appMetadataStub: AppMetadataStub, value: string) => AppMetadataStub;
|
||||||
readonly expectedValue: string;
|
readonly expectedValue: string;
|
||||||
readonly getActualValue: (info: ProjectInformationFactoryStub) => string;
|
readonly getActualValue: (projectDetailsFactory: ProjectDetailsFactoryStub) => string;
|
||||||
}
|
}
|
||||||
const testCases: { [K in PropertyKeys<ProjectInformationFactoryStub>]: IMetadataTestCase } = {
|
const testScenarios: {
|
||||||
|
[K in PropertyKeys<ProjectDetailsFactoryStub>]: MetadataTestScenario
|
||||||
|
} = {
|
||||||
name: {
|
name: {
|
||||||
setMetadata: (metadata, value) => metadata.witName(value),
|
setMetadata: (metadata, value) => metadata.witName(value),
|
||||||
expectedValue: 'expected-app-name',
|
expectedValue: 'expected-app-name',
|
||||||
getActualValue: (info) => info.name,
|
getActualValue: (projectDetailsFactory) => projectDetailsFactory.name,
|
||||||
},
|
},
|
||||||
version: {
|
version: {
|
||||||
setMetadata: (metadata, value) => metadata.withVersion(value),
|
setMetadata: (metadata, value) => metadata.withVersion(value),
|
||||||
expectedValue: '0.11.3',
|
expectedValue: '0.11.3',
|
||||||
getActualValue: (info) => info.version.toString(),
|
getActualValue: (projectDetailsFactory) => projectDetailsFactory.version.toString(),
|
||||||
},
|
},
|
||||||
slogan: {
|
slogan: {
|
||||||
setMetadata: (metadata, value) => metadata.withSlogan(value),
|
setMetadata: (metadata, value) => metadata.withSlogan(value),
|
||||||
expectedValue: 'expected-slogan',
|
expectedValue: 'expected-slogan',
|
||||||
getActualValue: (info) => info.slogan,
|
getActualValue: (projectDetailsFactory) => projectDetailsFactory.slogan,
|
||||||
},
|
},
|
||||||
repositoryUrl: {
|
repositoryUrl: {
|
||||||
setMetadata: (metadata, value) => metadata.withRepositoryUrl(value),
|
setMetadata: (metadata, value) => metadata.withRepositoryUrl(value),
|
||||||
expectedValue: 'https://expected-repository.url',
|
expectedValue: 'https://expected-repository.url',
|
||||||
getActualValue: (info) => info.repositoryUrl,
|
getActualValue: (projectDetailsFactory) => projectDetailsFactory.repositoryUrl,
|
||||||
},
|
},
|
||||||
homepage: {
|
homepage: {
|
||||||
setMetadata: (metadata, value) => metadata.withHomepageUrl(value),
|
setMetadata: (metadata, value) => metadata.withHomepageUrl(value),
|
||||||
expectedValue: 'https://expected.sexy',
|
expectedValue: 'https://expected.sexy',
|
||||||
getActualValue: (info) => info.homepage,
|
getActualValue: (projectDetailsFactory) => projectDetailsFactory.homepage,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Object.entries(testCases).forEach(([propertyName, {
|
Object.entries(testScenarios).forEach(([propertyName, {
|
||||||
expectedValue, setMetadata, getActualValue,
|
expectedValue, setMetadata, getActualValue,
|
||||||
}]) => {
|
}]) => {
|
||||||
it(propertyName, () => {
|
it(propertyName, () => {
|
||||||
// act
|
// act
|
||||||
const metadata = setMetadata(new AppMetadataStub(), expectedValue);
|
const metadata = setMetadata(new AppMetadataStub(), expectedValue);
|
||||||
const factoryStub = new ProjectInformationFactoryStub();
|
const projectDetailsFactoryStub = new ProjectDetailsFactoryStub();
|
||||||
// act
|
// act
|
||||||
parseProjectInformation(metadata, factoryStub.getStub());
|
parseProjectDetails(metadata, projectDetailsFactoryStub.getStub());
|
||||||
// assert
|
// assert
|
||||||
const actual = getActualValue(factoryStub);
|
const actual = getActualValue(projectDetailsFactoryStub);
|
||||||
expect(actual).to.be.equal(expectedValue);
|
expect(actual).to.be.equal(expectedValue);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -87,7 +89,7 @@ describe('ProjectInformationParser', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
class ProjectInformationFactoryStub {
|
class ProjectDetailsFactoryStub {
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
||||||
public version: Version;
|
public version: Version;
|
||||||
@@ -98,14 +100,14 @@ class ProjectInformationFactoryStub {
|
|||||||
|
|
||||||
public homepage: string;
|
public homepage: string;
|
||||||
|
|
||||||
public getStub(): ProjectInformationFactory {
|
public getStub(): ProjectDetailsFactory {
|
||||||
return (name, version, slogan, repositoryUrl, homepage) => {
|
return (name, version, slogan, repositoryUrl, homepage) => {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.slogan = slogan;
|
this.slogan = slogan;
|
||||||
this.repositoryUrl = repositoryUrl;
|
this.repositoryUrl = repositoryUrl;
|
||||||
this.homepage = homepage;
|
this.homepage = homepage;
|
||||||
return new ProjectInformationStub();
|
return new ProjectDetailsStub();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { CodeSubstituter } from '@/application/Parser/ScriptingDefinition/CodeSubstituter';
|
import { CodeSubstituter } from '@/application/Parser/ScriptingDefinition/CodeSubstituter';
|
||||||
import { IExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/IExpressionsCompiler';
|
import { IExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/IExpressionsCompiler';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
import { ExpressionsCompilerStub } from '@tests/unit/shared/Stubs/ExpressionsCompilerStub';
|
import { ExpressionsCompilerStub } from '@tests/unit/shared/Stubs/ExpressionsCompilerStub';
|
||||||
import { itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
import { itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||||
|
|
||||||
@@ -11,26 +11,26 @@ describe('CodeSubstituter', () => {
|
|||||||
// arrange
|
// arrange
|
||||||
const expectedError = 'missing code';
|
const expectedError = 'missing code';
|
||||||
const code = emptyCode;
|
const code = emptyCode;
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const sut = new CodeSubstituterBuilder().build();
|
const sut = new CodeSubstituterBuilder().build();
|
||||||
// act
|
// act
|
||||||
const act = () => sut.substitute(code, info);
|
const act = () => sut.substitute(code, projectDetails);
|
||||||
// assert
|
// assert
|
||||||
expect(act).to.throw(expectedError);
|
expect(act).to.throw(expectedError);
|
||||||
}, { excludeNull: true, excludeUndefined: true });
|
}, { excludeNull: true, excludeUndefined: true });
|
||||||
});
|
});
|
||||||
describe('substitutes parameters as expected values', () => {
|
describe('substitutes parameters as expected values', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const testCases: Array<{ parameter: string, argument: string }> = [
|
const testCases: Array<{ parameter: string, argument: string }> = [
|
||||||
{
|
{
|
||||||
parameter: 'homepage',
|
parameter: 'homepage',
|
||||||
argument: info.homepage,
|
argument: projectDetails.homepage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
parameter: 'version',
|
parameter: 'version',
|
||||||
argument: info.version.toString(),
|
argument: projectDetails.version.toString(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
parameter: 'date',
|
parameter: 'date',
|
||||||
@@ -45,7 +45,7 @@ describe('CodeSubstituter', () => {
|
|||||||
.withDate(date)
|
.withDate(date)
|
||||||
.build();
|
.build();
|
||||||
// act
|
// act
|
||||||
sut.substitute('non empty code', info);
|
sut.substitute('non empty code', projectDetails);
|
||||||
// assert
|
// assert
|
||||||
expect(compilerStub.callHistory).to.have.lengthOf(1);
|
expect(compilerStub.callHistory).to.have.lengthOf(1);
|
||||||
const parameters = compilerStub.callHistory[0].args[1];
|
const parameters = compilerStub.callHistory[0].args[1];
|
||||||
@@ -63,7 +63,7 @@ describe('CodeSubstituter', () => {
|
|||||||
.withCompiler(compilerStub)
|
.withCompiler(compilerStub)
|
||||||
.build();
|
.build();
|
||||||
// act
|
// act
|
||||||
sut.substitute(expected, new ProjectInformationStub());
|
sut.substitute(expected, new ProjectDetailsStub());
|
||||||
// assert
|
// assert
|
||||||
expect(compilerStub.callHistory).to.have.lengthOf(1);
|
expect(compilerStub.callHistory).to.have.lengthOf(1);
|
||||||
expect(compilerStub.callHistory[0].args[0]).to.equal(expected);
|
expect(compilerStub.callHistory[0].args[0]).to.equal(expected);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ScriptingDefinitionParser } from '@/application/Parser/ScriptingDefinit
|
|||||||
import { IEnumParser } from '@/application/Common/Enum';
|
import { IEnumParser } from '@/application/Common/Enum';
|
||||||
import { ICodeSubstituter } from '@/application/Parser/ScriptingDefinition/ICodeSubstituter';
|
import { ICodeSubstituter } from '@/application/Parser/ScriptingDefinition/ICodeSubstituter';
|
||||||
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
import { EnumParserStub } from '@tests/unit/shared/Stubs/EnumParserStub';
|
import { EnumParserStub } from '@tests/unit/shared/Stubs/EnumParserStub';
|
||||||
import { ScriptingDefinitionDataStub } from '@tests/unit/shared/Stubs/ScriptingDefinitionDataStub';
|
import { ScriptingDefinitionDataStub } from '@tests/unit/shared/Stubs/ScriptingDefinitionDataStub';
|
||||||
import { CodeSubstituterStub } from '@tests/unit/shared/Stubs/CodeSubstituterStub';
|
import { CodeSubstituterStub } from '@tests/unit/shared/Stubs/CodeSubstituterStub';
|
||||||
@@ -17,7 +17,7 @@ describe('ScriptingDefinitionParser', () => {
|
|||||||
const expectedLanguage = ScriptingLanguage.batchfile;
|
const expectedLanguage = ScriptingLanguage.batchfile;
|
||||||
const languageText = 'batchfile';
|
const languageText = 'batchfile';
|
||||||
const expectedName = 'language';
|
const expectedName = 'language';
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const definition = new ScriptingDefinitionDataStub()
|
const definition = new ScriptingDefinitionDataStub()
|
||||||
.withLanguage(languageText);
|
.withLanguage(languageText);
|
||||||
const parserMock = new EnumParserStub<ScriptingLanguage>()
|
const parserMock = new EnumParserStub<ScriptingLanguage>()
|
||||||
@@ -26,7 +26,7 @@ describe('ScriptingDefinitionParser', () => {
|
|||||||
.withParser(parserMock)
|
.withParser(parserMock)
|
||||||
.build();
|
.build();
|
||||||
// act
|
// act
|
||||||
const actual = sut.parse(definition, info);
|
const actual = sut.parse(definition, projectDetails);
|
||||||
// assert
|
// assert
|
||||||
expect(actual.language).to.equal(expectedLanguage);
|
expect(actual.language).to.equal(expectedLanguage);
|
||||||
});
|
});
|
||||||
@@ -51,14 +51,14 @@ describe('ScriptingDefinitionParser', () => {
|
|||||||
];
|
];
|
||||||
for (const testCase of testCases) {
|
for (const testCase of testCases) {
|
||||||
it(testCase.name, () => {
|
it(testCase.name, () => {
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const substituterMock = new CodeSubstituterStub()
|
const substituterMock = new CodeSubstituterStub()
|
||||||
.setup(code, info, expected);
|
.setup(code, projectDetails, expected);
|
||||||
const sut = new ScriptingDefinitionParserBuilder()
|
const sut = new ScriptingDefinitionParserBuilder()
|
||||||
.withSubstituter(substituterMock)
|
.withSubstituter(substituterMock)
|
||||||
.build();
|
.build();
|
||||||
// act
|
// act
|
||||||
const definition = sut.parse(testCase.data, info);
|
const definition = sut.parse(testCase.data, projectDetails);
|
||||||
// assert
|
// assert
|
||||||
const actual = testCase.getActualValue(definition);
|
const actual = testCase.getActualValue(definition);
|
||||||
expect(actual).to.equal(expected);
|
expect(actual).to.equal(expected);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
|
|||||||
import { Application } from '@/domain/Application';
|
import { Application } from '@/domain/Application';
|
||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { CategoryCollectionStub } from '@tests/unit/shared/Stubs/CategoryCollectionStub';
|
import { CategoryCollectionStub } from '@tests/unit/shared/Stubs/CategoryCollectionStub';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||||
import { getAbsentCollectionTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
import { getAbsentCollectionTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||||
|
|
||||||
@@ -12,10 +12,10 @@ describe('Application', () => {
|
|||||||
// arrange
|
// arrange
|
||||||
const missingOs = OperatingSystem.Android;
|
const missingOs = OperatingSystem.Android;
|
||||||
const expectedError = `Operating system "${OperatingSystem[missingOs]}" is not defined in application`;
|
const expectedError = `Operating system "${OperatingSystem[missingOs]}" is not defined in application`;
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const collections = [new CategoryCollectionStub().withOs(OperatingSystem.Windows)];
|
const collections = [new CategoryCollectionStub().withOs(OperatingSystem.Windows)];
|
||||||
// act
|
// act
|
||||||
const sut = new Application(info, collections);
|
const sut = new Application(projectDetails, collections);
|
||||||
const act = () => sut.getCollection(missingOs);
|
const act = () => sut.getCollection(missingOs);
|
||||||
// assert
|
// assert
|
||||||
expect(act).to.throw(expectedError);
|
expect(act).to.throw(expectedError);
|
||||||
@@ -24,25 +24,25 @@ describe('Application', () => {
|
|||||||
// arrange
|
// arrange
|
||||||
const os = OperatingSystem.Windows;
|
const os = OperatingSystem.Windows;
|
||||||
const expected = new CategoryCollectionStub().withOs(os);
|
const expected = new CategoryCollectionStub().withOs(os);
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const collections = [expected, new CategoryCollectionStub().withOs(OperatingSystem.Android)];
|
const collections = [expected, new CategoryCollectionStub().withOs(OperatingSystem.Android)];
|
||||||
// act
|
// act
|
||||||
const sut = new Application(info, collections);
|
const sut = new Application(projectDetails, collections);
|
||||||
const actual = sut.getCollection(os);
|
const actual = sut.getCollection(os);
|
||||||
// assert
|
// assert
|
||||||
expect(actual).to.equals(expected);
|
expect(actual).to.equals(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('ctor', () => {
|
describe('ctor', () => {
|
||||||
describe('info', () => {
|
describe('projectDetails', () => {
|
||||||
it('sets as expected', () => {
|
it('sets as expected', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expected = new ProjectInformationStub();
|
const expectedProjectDetails = new ProjectDetailsStub();
|
||||||
const collections = [new CategoryCollectionStub()];
|
const collections = [new CategoryCollectionStub()];
|
||||||
// act
|
// act
|
||||||
const sut = new Application(expected, collections);
|
const sut = new Application(expectedProjectDetails, collections);
|
||||||
// assert
|
// assert
|
||||||
expect(sut.info).to.equal(expected);
|
expect(sut.projectDetails).to.equal(expectedProjectDetails);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('collections', () => {
|
describe('collections', () => {
|
||||||
@@ -75,10 +75,10 @@ describe('Application', () => {
|
|||||||
];
|
];
|
||||||
for (const testCase of testCases) {
|
for (const testCase of testCases) {
|
||||||
it(testCase.name, () => {
|
it(testCase.name, () => {
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const collections = testCase.value;
|
const collections = testCase.value;
|
||||||
// act
|
// act
|
||||||
const act = () => new Application(info, collections);
|
const act = () => new Application(projectDetails, collections);
|
||||||
// assert
|
// assert
|
||||||
expect(act).to.throw(testCase.expectedError);
|
expect(act).to.throw(testCase.expectedError);
|
||||||
});
|
});
|
||||||
@@ -86,10 +86,10 @@ describe('Application', () => {
|
|||||||
});
|
});
|
||||||
it('sets as expected', () => {
|
it('sets as expected', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const expected = [new CategoryCollectionStub()];
|
const expected = [new CategoryCollectionStub()];
|
||||||
// act
|
// act
|
||||||
const sut = new Application(info, expected);
|
const sut = new Application(projectDetails, expected);
|
||||||
// assert
|
// assert
|
||||||
expect(sut.collections).to.equal(expected);
|
expect(sut.collections).to.equal(expected);
|
||||||
});
|
});
|
||||||
@@ -99,10 +99,10 @@ describe('Application', () => {
|
|||||||
it('returns expected', () => {
|
it('returns expected', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expected = [OperatingSystem.Windows, OperatingSystem.macOS];
|
const expected = [OperatingSystem.Windows, OperatingSystem.macOS];
|
||||||
const info = new ProjectInformationStub();
|
const projectDetails = new ProjectDetailsStub();
|
||||||
const collections = expected.map((os) => new CategoryCollectionStub().withOs(os));
|
const collections = expected.map((os) => new CategoryCollectionStub().withOs(os));
|
||||||
// act
|
// act
|
||||||
const sut = new Application(info, collections);
|
const sut = new Application(projectDetails, collections);
|
||||||
const actual = sut.getSupportedOsList();
|
const actual = sut.getSupportedOsList();
|
||||||
// assert
|
// assert
|
||||||
expect(actual).to.deep.equal(expected);
|
expect(actual).to.deep.equal(expected);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { ProjectInformation } from '@/domain/ProjectInformation';
|
import { GitHubProjectDetails } from '@/domain/Project/GitHubProjectDetails';
|
||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { EnumRangeTestRunner } from '@tests/unit/application/Common/EnumRangeTestRunner';
|
import { EnumRangeTestRunner } from '@tests/unit/application/Common/EnumRangeTestRunner';
|
||||||
import { VersionStub } from '@tests/unit/shared/Stubs/VersionStub';
|
import { VersionStub } from '@tests/unit/shared/Stubs/VersionStub';
|
||||||
@@ -7,19 +7,19 @@ import { Version } from '@/domain/Version';
|
|||||||
import { PropertyKeys } from '@/TypeHelpers';
|
import { PropertyKeys } from '@/TypeHelpers';
|
||||||
import { SupportedOperatingSystem, AllSupportedOperatingSystems } from '@tests/shared/TestCases/SupportedOperatingSystems';
|
import { SupportedOperatingSystem, AllSupportedOperatingSystems } from '@tests/shared/TestCases/SupportedOperatingSystems';
|
||||||
|
|
||||||
describe('ProjectInformation', () => {
|
describe('GitHubProjectDetails', () => {
|
||||||
describe('retrieval of property values', () => {
|
describe('retrieval of property values', () => {
|
||||||
interface IInformationParsingTestCase {
|
interface PropertyTestScenario {
|
||||||
readonly description?: string;
|
readonly description?: string;
|
||||||
readonly expectedValue: string;
|
readonly expectedValue: string;
|
||||||
readonly buildWithExpectedValue: (
|
readonly buildWithExpectedValue: (
|
||||||
builder: ProjectInformationBuilder,
|
builder: ProjectDetailsBuilder,
|
||||||
expected: string,
|
expected: string,
|
||||||
) => ProjectInformationBuilder;
|
) => ProjectDetailsBuilder;
|
||||||
readonly getActualValue: (sut: ProjectInformation) => string;
|
readonly getActualValue: (sut: GitHubProjectDetails) => string;
|
||||||
}
|
}
|
||||||
const propertyTestCases: {
|
const propertyTestScenarios: {
|
||||||
readonly [K in PropertyKeys<ProjectInformation>]: readonly IInformationParsingTestCase[];
|
readonly [K in PropertyKeys<GitHubProjectDetails>]: readonly PropertyTestScenario[];
|
||||||
} = {
|
} = {
|
||||||
name: [{
|
name: [{
|
||||||
expectedValue: 'expected-app-name',
|
expectedValue: 'expected-app-name',
|
||||||
@@ -100,13 +100,13 @@ describe('ProjectInformation', () => {
|
|||||||
getActualValue: (sut) => sut.releaseUrl,
|
getActualValue: (sut) => sut.releaseUrl,
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
Object.entries(propertyTestCases).forEach(([propertyName, testList]) => {
|
Object.entries(propertyTestScenarios).forEach(([propertyName, testList]) => {
|
||||||
testList.forEach(({
|
testList.forEach(({
|
||||||
description, buildWithExpectedValue, expectedValue, getActualValue,
|
description, buildWithExpectedValue, expectedValue, getActualValue,
|
||||||
}) => {
|
}) => {
|
||||||
it(`${propertyName}${description ? ` (${description})` : ''}`, () => {
|
it(`${propertyName}${description ? ` (${description})` : ''}`, () => {
|
||||||
// arrange
|
// arrange
|
||||||
const builder = new ProjectInformationBuilder();
|
const builder = new ProjectDetailsBuilder();
|
||||||
const sut = buildWithExpectedValue(builder, expectedValue).build();
|
const sut = buildWithExpectedValue(builder, expectedValue).build();
|
||||||
|
|
||||||
// act
|
// act
|
||||||
@@ -144,7 +144,7 @@ describe('ProjectInformation', () => {
|
|||||||
it(`should return the expected download URL for ${OperatingSystem[operatingSystem]}`, () => {
|
it(`should return the expected download URL for ${OperatingSystem[operatingSystem]}`, () => {
|
||||||
// arrange
|
// arrange
|
||||||
const { expected, version, repositoryUrl } = testScenarios[operatingSystem];
|
const { expected, version, repositoryUrl } = testScenarios[operatingSystem];
|
||||||
const sut = new ProjectInformationBuilder()
|
const sut = new ProjectDetailsBuilder()
|
||||||
.withVersion(new VersionStub(version))
|
.withVersion(new VersionStub(version))
|
||||||
.withRepositoryUrl(repositoryUrl)
|
.withRepositoryUrl(repositoryUrl)
|
||||||
.build();
|
.build();
|
||||||
@@ -156,7 +156,7 @@ describe('ProjectInformation', () => {
|
|||||||
});
|
});
|
||||||
describe('should throw an error when provided with an invalid operating system', () => {
|
describe('should throw an error when provided with an invalid operating system', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const sut = new ProjectInformationBuilder()
|
const sut = new ProjectDetailsBuilder()
|
||||||
.build();
|
.build();
|
||||||
// act
|
// act
|
||||||
const act = (os: OperatingSystem) => sut.getDownloadUrl(os);
|
const act = (os: OperatingSystem) => sut.getDownloadUrl(os);
|
||||||
@@ -168,7 +168,7 @@ describe('ProjectInformation', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
class ProjectInformationBuilder {
|
class ProjectDetailsBuilder {
|
||||||
private name = 'default-name';
|
private name = 'default-name';
|
||||||
|
|
||||||
private version: Version = new VersionStub();
|
private version: Version = new VersionStub();
|
||||||
@@ -179,33 +179,33 @@ class ProjectInformationBuilder {
|
|||||||
|
|
||||||
private slogan = 'default-slogan';
|
private slogan = 'default-slogan';
|
||||||
|
|
||||||
public withName(name: string): ProjectInformationBuilder {
|
public withName(name: string): this {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withVersion(version: VersionStub): ProjectInformationBuilder {
|
public withVersion(version: VersionStub): this {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withSlogan(slogan: string): ProjectInformationBuilder {
|
public withSlogan(slogan: string): this {
|
||||||
this.slogan = slogan;
|
this.slogan = slogan;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withRepositoryUrl(repositoryUrl: string): ProjectInformationBuilder {
|
public withRepositoryUrl(repositoryUrl: string): this {
|
||||||
this.repositoryUrl = repositoryUrl;
|
this.repositoryUrl = repositoryUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withHomepage(homepage: string): ProjectInformationBuilder {
|
public withHomepage(homepage: string): this {
|
||||||
this.homepage = homepage;
|
this.homepage = homepage;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public build(): ProjectInformation {
|
public build(): GitHubProjectDetails {
|
||||||
return new ProjectInformation(
|
return new GitHubProjectDetails(
|
||||||
this.name,
|
this.name,
|
||||||
this.version,
|
this.version,
|
||||||
this.slogan,
|
this.slogan,
|
||||||
@@ -185,7 +185,7 @@ describe('NodeElectronSaveFileDialog', () => {
|
|||||||
const saveFileCall = fileWriterStub.callHistory.find((c) => c.methodName === 'writeAndVerifyFile');
|
const saveFileCall = fileWriterStub.callHistory.find((c) => c.methodName === 'writeAndVerifyFile');
|
||||||
expect(saveFileCall).to.equal(undefined);
|
expect(saveFileCall).to.equal(undefined);
|
||||||
});
|
});
|
||||||
it('logs cancelation info', async () => {
|
it('logs cancelation', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedLogMessagePart = 'File save cancelled';
|
const expectedLogMessagePart = 'File save cancelled';
|
||||||
const logger = new LoggerStub();
|
const logger = new LoggerStub();
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { useApplication } from '@/presentation/components/Shared/Hooks/UseApplication';
|
import { useApplication } from '@/presentation/components/Shared/Hooks/UseApplication';
|
||||||
import { ApplicationStub } from '@tests/unit/shared/Stubs/ApplicationStub';
|
import { ApplicationStub } from '@tests/unit/shared/Stubs/ApplicationStub';
|
||||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
import { ProjectDetailsStub } from '@tests/unit/shared/Stubs/ProjectDetailsStub';
|
||||||
|
|
||||||
describe('UseApplication', () => {
|
describe('UseApplication', () => {
|
||||||
it('should return expected info', () => {
|
it('should return expected projectDetails', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedInfo = new ProjectInformationStub()
|
const expectedProjectDetails = new ProjectDetailsStub()
|
||||||
.withName('expected-project-information');
|
.withName(`expected-${ProjectDetailsStub.name}`);
|
||||||
const application = new ApplicationStub()
|
const application = new ApplicationStub()
|
||||||
.withProjectInformation(expectedInfo);
|
.withProjectDetails(expectedProjectDetails);
|
||||||
// act
|
// act
|
||||||
const { info } = useApplication(application);
|
const { projectDetails } = useApplication(application);
|
||||||
// assert
|
// assert
|
||||||
expect(info).to.equal(expectedInfo);
|
expect(projectDetails).to.equal(expectedProjectDetails);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return expected application', () => {
|
it('should return expected application', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedApp = new ApplicationStub()
|
const expectedApp = new ApplicationStub()
|
||||||
.withProjectInformation(
|
.withProjectDetails(
|
||||||
new ProjectInformationStub().withName('expected-application'),
|
new ProjectDetailsStub().withName('expected-application'),
|
||||||
);
|
);
|
||||||
// act
|
// act
|
||||||
const { application } = useApplication(expectedApp);
|
const { application } = useApplication(expectedApp);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { IApplication } from '@/domain/IApplication';
|
import { IApplication } from '@/domain/IApplication';
|
||||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { ProjectInformationStub } from './ProjectInformationStub';
|
import { ProjectDetailsStub } from './ProjectDetailsStub';
|
||||||
import { CategoryCollectionStub } from './CategoryCollectionStub';
|
import { CategoryCollectionStub } from './CategoryCollectionStub';
|
||||||
|
|
||||||
export class ApplicationStub implements IApplication {
|
export class ApplicationStub implements IApplication {
|
||||||
public info: IProjectInformation = new ProjectInformationStub();
|
public projectDetails: ProjectDetails = new ProjectDetailsStub();
|
||||||
|
|
||||||
public collections: ICategoryCollection[] = [];
|
public collections: ICategoryCollection[] = [];
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ export class ApplicationStub implements IApplication {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withProjectInformation(info: IProjectInformation): this {
|
public withProjectDetails(info: ProjectDetails): this {
|
||||||
this.info = info;
|
this.projectDetails = info;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { ProjectInformation } from '@/domain/ProjectInformation';
|
|
||||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||||
import { getEnumValues } from '@/application/Common/Enum';
|
import { getEnumValues } from '@/application/Common/Enum';
|
||||||
import type { CollectionData } from '@/application/collections/';
|
import type { CollectionData } from '@/application/collections/';
|
||||||
@@ -10,7 +9,7 @@ import { CategoryCollectionStub } from './CategoryCollectionStub';
|
|||||||
export class CategoryCollectionParserStub {
|
export class CategoryCollectionParserStub {
|
||||||
public readonly arguments = new Array<{
|
public readonly arguments = new Array<{
|
||||||
data: CollectionData,
|
data: CollectionData,
|
||||||
info: ProjectInformation,
|
projectDetails: ProjectDetails,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
private readonly returnValues = new Map<CollectionData, ICategoryCollection>();
|
private readonly returnValues = new Map<CollectionData, ICategoryCollection>();
|
||||||
@@ -24,8 +23,8 @@ export class CategoryCollectionParserStub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getStub(): CategoryCollectionParserType {
|
public getStub(): CategoryCollectionParserType {
|
||||||
return (data: CollectionData, info: IProjectInformation): ICategoryCollection => {
|
return (data: CollectionData, projectDetails: ProjectDetails): ICategoryCollection => {
|
||||||
this.arguments.push({ data, info });
|
this.arguments.push({ data, projectDetails });
|
||||||
const foundReturnValue = this.returnValues.get(data);
|
const foundReturnValue = this.returnValues.get(data);
|
||||||
if (foundReturnValue) {
|
if (foundReturnValue) {
|
||||||
return foundReturnValue;
|
return foundReturnValue;
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { ICodeSubstituter } from '@/application/Parser/ScriptingDefinition/ICodeSubstituter';
|
import { ICodeSubstituter } from '@/application/Parser/ScriptingDefinition/ICodeSubstituter';
|
||||||
|
|
||||||
export class CodeSubstituterStub implements ICodeSubstituter {
|
export class CodeSubstituterStub implements ICodeSubstituter {
|
||||||
private readonly scenarios = new Array<{
|
private readonly scenarios = new Array<{
|
||||||
code: string, info: IProjectInformation, result: string }>();
|
code: string, projectDetails: ProjectDetails, result: string }>();
|
||||||
|
|
||||||
public substitute(code: string, info: IProjectInformation): string {
|
public substitute(code: string, projectDetails: ProjectDetails): string {
|
||||||
const scenario = this.scenarios.find((s) => s.code === code && s.info === info);
|
const scenario = this.scenarios.find(
|
||||||
|
(s) => s.code === code && s.projectDetails === projectDetails,
|
||||||
|
);
|
||||||
if (scenario) {
|
if (scenario) {
|
||||||
return scenario.result;
|
return scenario.result;
|
||||||
}
|
}
|
||||||
return `[CodeSubstituterStub] - code: ${code}`;
|
return `[CodeSubstituterStub] - code: ${code}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setup(code: string, info: IProjectInformation, result: string) {
|
public setup(code: string, projectDetails: ProjectDetails, result: string) {
|
||||||
this.scenarios.push({ code, info, result });
|
this.scenarios.push({ code, projectDetails, result });
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
tests/unit/shared/Stubs/ProjectDetailsParserStub.ts
Normal file
22
tests/unit/shared/Stubs/ProjectDetailsParserStub.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { parseProjectDetails } from '@/application/Parser/ProjectDetailsParser';
|
||||||
|
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
||||||
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
|
import { ProjectDetailsStub } from './ProjectDetailsStub';
|
||||||
|
|
||||||
|
export class ProjectDetailsParserStub {
|
||||||
|
public readonly arguments = new Array<IAppMetadata | undefined>();
|
||||||
|
|
||||||
|
private returnValue: ProjectDetails = new ProjectDetailsStub();
|
||||||
|
|
||||||
|
public withReturnValue(value: ProjectDetails): this {
|
||||||
|
this.returnValue = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getStub(): typeof parseProjectDetails {
|
||||||
|
return (metadata) => {
|
||||||
|
this.arguments.push(metadata);
|
||||||
|
return this.returnValue;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
import type { ProjectDetails } from '@/domain/Project/ProjectDetails';
|
||||||
import { Version } from '@/domain/Version';
|
import { Version } from '@/domain/Version';
|
||||||
import { VersionStub } from './VersionStub';
|
import { VersionStub } from './VersionStub';
|
||||||
|
|
||||||
export class ProjectInformationStub implements IProjectInformation {
|
export class ProjectDetailsStub implements ProjectDetails {
|
||||||
public name = 'stub-name';
|
public name = 'stub-name';
|
||||||
|
|
||||||
public version = new VersionStub();
|
public version = new VersionStub();
|
||||||
@@ -21,37 +21,37 @@ export class ProjectInformationStub implements IProjectInformation {
|
|||||||
|
|
||||||
public slogan = 'stub-slogan';
|
public slogan = 'stub-slogan';
|
||||||
|
|
||||||
public withName(name: string): ProjectInformationStub {
|
public withName(name: string): this {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withVersion(version: Version): ProjectInformationStub {
|
public withVersion(version: Version): this {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withRepositoryUrl(repositoryUrl: string): ProjectInformationStub {
|
public withRepositoryUrl(repositoryUrl: string): this {
|
||||||
this.repositoryUrl = repositoryUrl;
|
this.repositoryUrl = repositoryUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withHomepageUrl(homepageUrl: string): ProjectInformationStub {
|
public withHomepageUrl(homepageUrl: string): this {
|
||||||
this.homepage = homepageUrl;
|
this.homepage = homepageUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withFeedbackUrl(feedbackUrl: string): ProjectInformationStub {
|
public withFeedbackUrl(feedbackUrl: string): this {
|
||||||
this.feedbackUrl = feedbackUrl;
|
this.feedbackUrl = feedbackUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withReleaseUrl(releaseUrl: string): ProjectInformationStub {
|
public withReleaseUrl(releaseUrl: string): this {
|
||||||
this.releaseUrl = releaseUrl;
|
this.releaseUrl = releaseUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public withRepositoryWebUrl(repositoryWebUrl: string): ProjectInformationStub {
|
public withRepositoryWebUrl(repositoryWebUrl: string): this {
|
||||||
this.repositoryWebUrl = repositoryWebUrl;
|
this.repositoryWebUrl = repositoryWebUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
|
||||||
import { IAppMetadata } from '@/infrastructure/EnvironmentVariables/IAppMetadata';
|
|
||||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
|
||||||
import { ProjectInformationStub } from './ProjectInformationStub';
|
|
||||||
|
|
||||||
export class ProjectInformationParserStub {
|
|
||||||
public readonly arguments = new Array<IAppMetadata | undefined>();
|
|
||||||
|
|
||||||
private returnValue: IProjectInformation = new ProjectInformationStub();
|
|
||||||
|
|
||||||
public withReturnValue(value: IProjectInformation): this {
|
|
||||||
this.returnValue = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getStub(): typeof parseProjectInformation {
|
|
||||||
return (metadata) => {
|
|
||||||
this.arguments.push(metadata);
|
|
||||||
return this.returnValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ export class UseApplicationStub {
|
|||||||
public get(): ReturnType<typeof useApplication> {
|
public get(): ReturnType<typeof useApplication> {
|
||||||
return {
|
return {
|
||||||
application: this.application,
|
application: this.application,
|
||||||
info: this.application.info,
|
projectDetails: this.application.projectDetails,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user