@lichtblick/test-builders
v1.0.1
Published
Test utilities and builders for Lichtblick projects
Maintainers
Readme
@lichtblick/test-builders
Test utilities and builders for Lichtblick projects.
Installation
npm install --save-dev @lichtblick/test-builders
# or
yarn add -D @lichtblick/test-buildersUsage
import { BasicBuilder } from "@lichtblick/test-builders";
// Generate random test data
const randomString = BasicBuilder.string({ length: 10 });
const randomNumber = BasicBuilder.number({ min: 1, max: 100 });
const randomDateTime = BasicBuilder.datetime();
const randomDate = BasicBuilder.date();
const randomBoolean = BasicBuilder.boolean();
const randomFloat = BasicBuilder.float(1, 100);
const randomBigInt = BasicBuilder.bigInt(BigInt(1), BigInt(100));
const randomArray = BasicBuilder.multiple(() => BasicBuilder.string(), 5);
const randomSample = BasicBuilder.sample(["option1", "option2", "option3"]);
const randomMap = BasicBuilder.genericMap(() => BasicBuilder.number());
const randomDict = BasicBuilder.genericDictionary(() => BasicBuilder.boolean());Available Builders
BasicBuilder- Basic data types (strings, numbers, dates, booleans, maps, arrays, etc.)datetime()- Generate random datetime strings (ISO 8601 format)date()- Generate random Date objectsboolean()- Generate random booleansnumber()- Generate random integers with configurable min/maxfloat()- Generate random floats with configurable min/maxbigInt()- Generate random bigints with configurable min/maxstring()- Generate random strings with configurable length, charset, and capitalizationstringMap()- Generate random Map<string, string> with configurable count and key/value optionsgenericMap()- Generate random Map<string, T> with custom value generatorgenericDictionary()- Generate random Record<string, T> with custom value generatormultiple()- Generate arrays of random values using a factory functionnumbers()- Generate arrays of random numbersstrings()- Generate arrays of random strings with configurable optionssample()- Pick random sample(s) from array or object
Utilities
defaults
Merge partial props with fallback props.
callPrivateMethod
Helper function to call private methods for testing purposes.
Development
Git Flow
This project follows Git Flow branching strategy:
main- Production releasesdevelop- Integration branchfeature/*- New featuresrelease/*- Release preparationhotfix/*- Production hotfixes
See Git Flow Guide for details.
Scripts
# Development
yarn build # Build the package
yarn test # Run tests
yarn lint # Lint and fix
yarn format # Format code
yarn validate # Run all checksCI/CD
- ✅ Automated testing on push
- 📦 Auto-publish to NPM on release
- 🔄 Auto-merge main → develop
- 📊 Code coverage reporting
Create releases via GitHub Actions UI or scripts. See Git Flow Guide.
Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/my-feature develop - Commit:
git commit -m "feat: add feature" - Push:
git push origin feature/my-feature - Open PR to
develop
License
MPL-2.0 - Copyright (C) 2023-2025 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
