Refactor text utilities and expand their usage
This commit refactors existing text utility functions into the application layer for broad reuse and integrates them across the codebase. Initially, these utilities were confined to test code, which limited their application. Changes: - Move text utilities to the application layer. - Centralize text utilities into dedicated files for better maintainability. - Improve robustness of utility functions with added type checks. - Replace duplicated logic with centralized utility functions throughout the codebase. - Expand unit tests to cover refactored code parts.
This commit is contained in:
14
tests/unit/shared/Stubs/IsArrayStub.ts
Normal file
14
tests/unit/shared/Stubs/IsArrayStub.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { isArray } from '@/TypeHelpers';
|
||||
|
||||
export class IsArrayStub {
|
||||
private predeterminedResult = true;
|
||||
|
||||
public withPredeterminedResult(predeterminedResult: boolean): this {
|
||||
this.predeterminedResult = predeterminedResult;
|
||||
return this;
|
||||
}
|
||||
|
||||
public get(): typeof isArray {
|
||||
return (value: unknown): value is Array<unknown> => this.predeterminedResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user