# Part Factory > Part Factory builds test entity factories for TypeScript. A factory produces fully-typed objects for tests, with deep partial overrides for the fields a given test cares about and sensible values for the rest. It is an npm package, @kensio/part-factory. Each link below is the plain markdown of one page. Drop the `llms.txt` from a link for the page itself: https://partfactory.dev/factories/static-factory/llms.txt is https://partfactory.dev/factories/static-factory/ as HTML. ## Factories - [StaticFactory](https://partfactory.dev/factories/static-factory/llms.txt): Creates complete items from one static set of default values. - [DynamicFactory](https://partfactory.dev/factories/dynamic-factory/llms.txt): Creates complete items from a function that builds default values. - [VariantFactory](https://partfactory.dev/factories/variant-factory/llms.txt): Creates complete items from another factory with preset overrides. - [MappedFactory](https://partfactory.dev/factories/mapped-factory/llms.txt): Creates output values by mapping a completed input object. - [AsyncMappedFactory](https://partfactory.dev/factories/async-mapped-factory/llms.txt): Creates output values asynchronously by mapping a completed input object. ## Guides - [Deep partial overrides](https://partfactory.dev/deep-partial/llms.txt): Part Factory lets you override only the values that matter for a test. ## Optional - [npm package](https://www.npmjs.com/package/@kensio/part-factory): install and version history - [Source repository](https://github.com/KensioSoftware/part-factory): source, issues and the docblocks these pages are built from --- # Part Factory test entity factories Source: https://partfactory.dev/ Part Factory is a minimalist object factory pattern for TypeScript. It helps you create strongly typed factories with useful default value generation, then override those defaults as needed in each test case. ## Installation ```bash npm install -D @kensio/part-factory ``` ## Usage Suppose you have an object with this structure, and you want to generate valid instances for tests: ```typescript interface Foo { name: string; size: number; } ``` Part Factory lets you define reusable factories for those objects, with strongly typed defaults and strongly typed overrides. Create a factory with suitable defaults, then override only the values that matter for the current test. ```typescript import { StaticFactory } from "@kensio/part-factory"; interface Foo { name: string; size: number; } const fooFactory = new StaticFactory({ name: "Foobar", size: 10, }); const defaultFoo = fooFactory.make(); // { name: "Foobar", size: 10 } const myFoo = fooFactory.make({ size: 20 }); // { name: "Foobar", size: 20 } ``` Overrides are partial through the object structure, so you can override a nested value without replacing the whole tree. ```typescript const userProfile = userProfileFactory.make({ contact: { address: { city: "Manchester" } }, }); ```