From 922254cc7ea74adaae2ea8d5b207d2849089c02e Mon Sep 17 00:00:00 2001 From: omermorad Date: Mon, 2 Nov 2026 15:45:17 +0200 Subject: [PATCH 1/3] fix(search): query the full index from non-docs routes Contextual search filters by docusaurus_tag. The crawler config only matches https://suites.dev/docs/**, so every record carries docusaurus_tag:docs-default-current and none carries the docusaurus_tag:default value the theme sends from the homepage and other src/pages routes. Searching from those routes returned zero hits against an index of 507 records. The site has one docs version and one language, so contextual filtering has nothing to disambiguate. Turning it off lets every route query the same index. --- docusaurus.config.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 869d4d4..6a55bd3 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -122,7 +122,12 @@ const config: Config = { disableSwitch: true, defaultMode: "dark", }, - algolia: algoliaConfig, + // The crawler only matches /docs/**, so no record carries the + // docusaurus_tag:default value that contextual search sends from the + // homepage and other src/pages routes, and search there returns nothing. + // One docs version and one language means contextual filtering buys us + // nothing, so every route queries the same index. + algolia: { ...algoliaConfig, contextualSearch: false }, navbar: { title: "Suites", logo: { From 1b3e3f6ab57ad79169806aa15e133322098056ab Mon Sep 17 00:00:00 2001 From: omermorad Date: Mon, 2 Nov 2026 15:48:18 +0200 Subject: [PATCH 2/3] fix(docs): repoint five links at headings that exist Every one sat in a See Also list and landed the reader at the top of the target page instead of the section the link text named. - types#mocked -> types/#mockedt, the heading is `Mocked` - testbed-solitary#pre-compile-mock-configuration -> #configuring-mocks - installation#typescript-configuration -> #setting-up-tsconfigjson - types#unitreference -> the unit-reference page, which is where UnitReference is actually documented - guides/fundamentals#solitary-tests -> the solitary guide, matching what the link text promises --- docs/api-reference/mock.md | 4 ++-- docs/api-reference/testbed-solitary.md | 4 ++-- docs/api-reference/types.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api-reference/mock.md b/docs/api-reference/mock.md index 31b85fd..6eb68a4 100644 --- a/docs/api-reference/mock.md +++ b/docs/api-reference/mock.md @@ -286,6 +286,6 @@ obj.method2.mockReturnValue(100); ## See Also -- [Types](/docs/api-reference/types#mocked) - `Mocked` type definition +- [Types](/docs/api-reference/types/#mockedt) - `Mocked` type definition - [TestBed.solitary()](/docs/api-reference/testbed-solitary) - Automatic dependency mocking -- [TestBed Configuration](/docs/api-reference/testbed-solitary#pre-compile-mock-configuration) - Using `.mock().impl()` with `stub()` +- [TestBed Configuration](/docs/api-reference/testbed-solitary/#configuring-mocks) - Using `.mock().impl()` with `stub()` diff --git a/docs/api-reference/testbed-solitary.md b/docs/api-reference/testbed-solitary.md index bd612d5..5d30e24 100644 --- a/docs/api-reference/testbed-solitary.md +++ b/docs/api-reference/testbed-solitary.md @@ -85,7 +85,7 @@ repository.invalidMethod.mockReturnValue(123); ## See Also -- [Solitary Tests Guide](/docs/guides/fundamentals#solitary-tests) - Conceptual guide +- [Solitary Tests Guide](/docs/guides/solitary/) - Conceptual guide - [TestBed.sociable()](/docs/api-reference/testbed-sociable) - Test with real dependencies -- [UnitReference](/docs/api-reference/types#unitreference) - Accessing mocked dependencies with `unitRef.get()` +- [UnitReference](/docs/api-reference/unit-reference/) - Accessing mocked dependencies with `unitRef.get()` - [Virtual Test Container](/docs/guides/virtual-test-container) - How Suites auto-mocks dependencies diff --git a/docs/api-reference/types.md b/docs/api-reference/types.md index 403c4e7..fe1bd29 100644 --- a/docs/api-reference/types.md +++ b/docs/api-reference/types.md @@ -88,4 +88,4 @@ describe('UserService', () => { - [UnitReference](/docs/api-reference/unit-reference) - Using the UnitReference interface - [Mock Configuration](/docs/api-reference/mock-configuration) - Configuring mocks with proper types -- [TypeScript Configuration](/docs/get-started/installation#typescript-configuration) - Setting up TypeScript for Suites \ No newline at end of file +- [TypeScript Configuration](/docs/get-started/installation/#setting-up-tsconfigjson) - Setting up TypeScript for Suites \ No newline at end of file From b09d017633042cd1a7ca7c535739c049f6d0324f Mon Sep 17 00:00:00 2001 From: omermorad Date: Mon, 2 Nov 2026 15:48:36 +0200 Subject: [PATCH 3/3] fix(docs): slash-terminate internal links PR #26 set trailingSlash: true, so Netlify now redirects the no-slash form of every docs route. The 90 internal links still written without the slash each cost a 301 on click. --- docs/api-reference/index.md | 12 ++++++------ docs/api-reference/mock-configuration.md | 8 ++++---- docs/api-reference/mock.md | 4 ++-- docs/api-reference/testbed-sociable.md | 8 ++++---- docs/api-reference/testbed-solitary.md | 8 ++++---- docs/api-reference/types.md | 4 ++-- docs/api-reference/unit-reference.md | 10 +++++----- docs/changelog.md | 2 +- docs/get-started/index.md | 12 ++++++------ docs/get-started/installation.mdx | 2 +- docs/get-started/quickstart.md | 14 +++++++------- docs/get-started/why-suites.md | 4 ++-- docs/guides/fundamentals.md | 14 +++++++------- docs/guides/index.md | 12 ++++++------ docs/guides/sociable.md | 6 +++--- docs/guides/solitary.md | 22 +++++++++++----------- docs/guides/test-doubles.md | 12 ++++++------ docs/guides/virtual-test-container.md | 6 +++--- docs/migration-guides/from-automock.md | 18 +++++++++--------- docs/migration-guides/index.md | 2 +- 20 files changed, 90 insertions(+), 90 deletions(-) diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index fb40012..5bf5eff 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -12,12 +12,12 @@ API reference for setting up and managing unit tests with Suites. ### Core APIs -- [**TestBed.solitary()**](/docs/api-reference/testbed-solitary) - Create isolated unit tests where all dependencies are automatically mocked -- [**TestBed.sociable()**](/docs/api-reference/testbed-sociable) - Test business logic interactions, keep specific dependencies real -- [**Mock Configuration**](/docs/api-reference/mock-configuration) - Configure mock behavior with `.mock().final()` and `.mock().impl()` -- [**mock() and stub()**](/docs/api-reference/mock) - Create standalone mocks outside `TestBed` API -- [**UnitReference**](/docs/api-reference/unit-reference) - Access mocked dependencies in tests -- [**Types**](/docs/api-reference/types) - TypeScript type definitions +- [**TestBed.solitary()**](/docs/api-reference/testbed-solitary/) - Create isolated unit tests where all dependencies are automatically mocked +- [**TestBed.sociable()**](/docs/api-reference/testbed-sociable/) - Test business logic interactions, keep specific dependencies real +- [**Mock Configuration**](/docs/api-reference/mock-configuration/) - Configure mock behavior with `.mock().final()` and `.mock().impl()` +- [**mock() and stub()**](/docs/api-reference/mock/) - Create standalone mocks outside `TestBed` API +- [**UnitReference**](/docs/api-reference/unit-reference/) - Access mocked dependencies in tests +- [**Types**](/docs/api-reference/types/) - TypeScript type definitions diff --git a/docs/api-reference/mock-configuration.md b/docs/api-reference/mock-configuration.md index 297cc3e..1988a03 100644 --- a/docs/api-reference/mock-configuration.md +++ b/docs/api-reference/mock-configuration.md @@ -11,7 +11,7 @@ Suites provides two methods for configuring mock behavior: * `.mock().impl()` for flexible implementations :::note -This page describes the `.mock()` configuration method for `TestBed`. For creating standalone mocks manually, see the [`mock()` and `stub()` utility functions](/docs/api-reference/mock). +This page describes the `.mock()` configuration method for `TestBed`. For creating standalone mocks manually, see the [`mock()` and `stub()` utility functions](/docs/api-reference/mock/). ::: ## Methods @@ -123,6 +123,6 @@ const logger = unitRef.get(Logger); ## See Also -- [TestBed.solitary()](/docs/api-reference/testbed-solitary) - Creating isolated tests -- [TestBed.sociable()](/docs/api-reference/testbed-sociable) - Creating sociable tests -- [UnitReference](/docs/api-reference/unit-reference) - Accessing configured mocks +- [TestBed.solitary()](/docs/api-reference/testbed-solitary/) - Creating isolated tests +- [TestBed.sociable()](/docs/api-reference/testbed-sociable/) - Creating sociable tests +- [UnitReference](/docs/api-reference/unit-reference/) - Accessing configured mocks diff --git a/docs/api-reference/mock.md b/docs/api-reference/mock.md index 6eb68a4..050d87d 100644 --- a/docs/api-reference/mock.md +++ b/docs/api-reference/mock.md @@ -48,7 +48,7 @@ function mock(mockImplementation: DeepPartial = {}): Mocked `Mocked` - A deeply mocked instance where all methods are automatically stubbed. :::note -See [Types](/docs/api-reference/types#mockedt) for more about the `Mocked` type. +See [Types](/docs/api-reference/types/#mockedt) for more about the `Mocked` type. ::: ### How It Works @@ -287,5 +287,5 @@ obj.method2.mockReturnValue(100); ## See Also - [Types](/docs/api-reference/types/#mockedt) - `Mocked` type definition -- [TestBed.solitary()](/docs/api-reference/testbed-solitary) - Automatic dependency mocking +- [TestBed.solitary()](/docs/api-reference/testbed-solitary/) - Automatic dependency mocking - [TestBed Configuration](/docs/api-reference/testbed-solitary/#configuring-mocks) - Using `.mock().impl()` with `stub()` diff --git a/docs/api-reference/testbed-sociable.md b/docs/api-reference/testbed-sociable.md index 8f28e16..20792bb 100644 --- a/docs/api-reference/testbed-sociable.md +++ b/docs/api-reference/testbed-sociable.md @@ -11,7 +11,7 @@ Creates a test environment that mixes real implementations with mocked dependenc :::info Sociable Tests Are Still Unit Tests Even with multiple real classes, sociable tests remain unit tests because external I/O (databases, HTTP, caches) are injected via tokens (`@Inject('DATABASE')`) which are automatically mocked. You're testing business logic interactions, -not actual I/O. See the [Sociable Unit Tests Guide](/docs/guides/sociable) for concepts. +not actual I/O. See the [Sociable Unit Tests Guide](/docs/guides/sociable/) for concepts. ::: ## Signature @@ -71,6 +71,6 @@ const database = unitRef.get(Database); ## See Also -- [Sociable Unit Tests Guide](/docs/guides/sociable) - When to use, concepts, detailed examples -- [TestBed.solitary()](/docs/api-reference/testbed-solitary) - For fully isolated tests -- [Mock Configuration](/docs/api-reference/mock-configuration) - Configuring mock behavior +- [Sociable Unit Tests Guide](/docs/guides/sociable/) - When to use, concepts, detailed examples +- [TestBed.solitary()](/docs/api-reference/testbed-solitary/) - For fully isolated tests +- [Mock Configuration](/docs/api-reference/mock-configuration/) - Configuring mock behavior diff --git a/docs/api-reference/testbed-solitary.md b/docs/api-reference/testbed-solitary.md index 5d30e24..efb37bc 100644 --- a/docs/api-reference/testbed-solitary.md +++ b/docs/api-reference/testbed-solitary.md @@ -31,11 +31,11 @@ Returns a `SolitaryTestBedBuilder` instance with methods for configuring `TestBed.solitary()` creates a test environment where all of the class's dependencies are mocked by default. This is ideal for testing the internal logic of a class in complete isolation. -Suites automatically identifies and mocks all constructor dependencies, which can then be accessed via `unitRef.get()`. Learn more in the [Virtual Test Container](/docs/guides/virtual-test-container) guide. +Suites automatically identifies and mocks all constructor dependencies, which can then be accessed via `unitRef.get()`. Learn more in the [Virtual Test Container](/docs/guides/virtual-test-container/) guide. ## Configuring Mocks -See [Mock Configuration](/docs/api-reference/mock-configuration) for details on `.mock().final()` and `.mock().impl()`. +See [Mock Configuration](/docs/api-reference/mock-configuration/) for details on `.mock().final()` and `.mock().impl()`. ## Examples @@ -86,6 +86,6 @@ repository.invalidMethod.mockReturnValue(123); ## See Also - [Solitary Tests Guide](/docs/guides/solitary/) - Conceptual guide -- [TestBed.sociable()](/docs/api-reference/testbed-sociable) - Test with real dependencies +- [TestBed.sociable()](/docs/api-reference/testbed-sociable/) - Test with real dependencies - [UnitReference](/docs/api-reference/unit-reference/) - Accessing mocked dependencies with `unitRef.get()` -- [Virtual Test Container](/docs/guides/virtual-test-container) - How Suites auto-mocks dependencies +- [Virtual Test Container](/docs/guides/virtual-test-container/) - How Suites auto-mocks dependencies diff --git a/docs/api-reference/types.md b/docs/api-reference/types.md index fe1bd29..b53cb4c 100644 --- a/docs/api-reference/types.md +++ b/docs/api-reference/types.md @@ -86,6 +86,6 @@ describe('UserService', () => { ## See Also -- [UnitReference](/docs/api-reference/unit-reference) - Using the UnitReference interface -- [Mock Configuration](/docs/api-reference/mock-configuration) - Configuring mocks with proper types +- [UnitReference](/docs/api-reference/unit-reference/) - Using the UnitReference interface +- [Mock Configuration](/docs/api-reference/mock-configuration/) - Configuring mocks with proper types - [TypeScript Configuration](/docs/get-started/installation/#setting-up-tsconfigjson) - Setting up TypeScript for Suites \ No newline at end of file diff --git a/docs/api-reference/unit-reference.md b/docs/api-reference/unit-reference.md index 285cc56..7eaff92 100644 --- a/docs/api-reference/unit-reference.md +++ b/docs/api-reference/unit-reference.md @@ -145,7 +145,7 @@ const database = unitRef.get(Database); ## Type Safety -The `Mocked` type ensures type safety for your mocks (See more in [Types Reference](/docs/api-reference/types): +The `Mocked` type ensures type safety for your mocks (See more in [Types Reference](/docs/api-reference/types/): ```typescript interface UserRepository { @@ -205,7 +205,7 @@ const logger = unitRef.get('LoggerToken'); // ✅ Correct symbol ## See Also -- [Types](/docs/api-reference/types) - Type definitions including `Mocked` -- [Mock Configuration](/docs/api-reference/mock-configuration) - Configuring mock behavior -- [TestBed.solitary()](/docs/api-reference/testbed-solitary) - Creating isolated tests -- [TestBed.sociable()](/docs/api-reference/testbed-sociable) - Creating sociable tests \ No newline at end of file +- [Types](/docs/api-reference/types/) - Type definitions including `Mocked` +- [Mock Configuration](/docs/api-reference/mock-configuration/) - Configuring mock behavior +- [TestBed.solitary()](/docs/api-reference/testbed-solitary/) - Creating isolated tests +- [TestBed.sociable()](/docs/api-reference/testbed-sociable/) - Creating sociable tests \ No newline at end of file diff --git a/docs/changelog.md b/docs/changelog.md index 959169e..87a5b23 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -81,7 +81,7 @@ const { unit } = await TestBed.solitary(UserService).compile(); **Migration Support** We've prepared comprehensive migration guides to help you upgrade smoothly: -- [Migration from Automock →](/docs/migration-guides/from-automock) +- [Migration from Automock →](/docs/migration-guides/from-automock/) - Migration tool development in progress [View full release notes →](https://github.com/suites-dev/suites/releases/tag/v3.0.0) diff --git a/docs/get-started/index.md b/docs/get-started/index.md index 7142743..d9bc488 100644 --- a/docs/get-started/index.md +++ b/docs/get-started/index.md @@ -10,9 +10,9 @@ Learn how to install Suites, configure the testing environment, and write the fi
### In This Section -- [**Why Suites?**](/docs/get-started/why-suites) - Compare with manual mocking and explore what Suites provides -- [**Installation**](/docs/get-started/installation) - Install and configure Suites -- [**Quick Start**](/docs/get-started/quickstart) - Write the first test in 5 minutes +- [**Why Suites?**](/docs/get-started/why-suites/) - Compare with manual mocking and explore what Suites provides +- [**Installation**](/docs/get-started/installation/) - Install and configure Suites +- [**Quick Start**](/docs/get-started/quickstart/) - Write the first test in 5 minutes
## Prerequisites @@ -33,9 +33,9 @@ Currently: dependency injection frameworks (NestJS, InversifyJS) via TestBed, or For those new to Suites: -1. **[Why Suites?](/docs/get-started/why-suites)** - Explore what Suites provides -2. **[Installation](/docs/get-started/installation)** - Set up the environment -3. **[Quick Start](/docs/get-started/quickstart)** - Write the first test +1. **[Why Suites?](/docs/get-started/why-suites/)** - Explore what Suites provides +2. **[Installation](/docs/get-started/installation/)** - Set up the environment +3. **[Quick Start](/docs/get-started/quickstart/)** - Write the first test 4. **[Guides](/docs/guides/)** - Learn testing patterns ## Resources diff --git a/docs/get-started/installation.mdx b/docs/get-started/installation.mdx index 6ca9d2f..80291b8 100644 --- a/docs/get-started/installation.mdx +++ b/docs/get-started/installation.mdx @@ -292,7 +292,7 @@ Vitest 4.x uses Oxc by default instead of esbuild. The `esbuild: false` option i
## What's Next? - - Check out the [Quick Start](/docs/get-started/quickstart) guide to write the first test + - Check out the [Quick Start](/docs/get-started/quickstart/) guide to write the first test - Explore the [Guides](/docs/guides/) section for testing patterns - Browse [working examples](https://github.com/suites-dev/examples) for real-world code
\ No newline at end of file diff --git a/docs/get-started/quickstart.md b/docs/get-started/quickstart.md index b0f2dc6..70a2bae 100644 --- a/docs/get-started/quickstart.md +++ b/docs/get-started/quickstart.md @@ -23,7 +23,7 @@ Complete source code for this example (and more) is available in the [Suites Exa ## Prerequisites -Before starting, ensure the [Installation guide](/docs/get-started/installation) has been completed to set up the project with Suites. +Before starting, ensure the [Installation guide](/docs/get-started/installation/) has been completed to set up the project with Suites. - Basic knowledge of TypeScript and unit testing - Familiarity with dependency injection patterns @@ -183,7 +183,7 @@ describe('Notification Service Sociable Spec', () => { :::tip Sociable tests verify that components integrate correctly while keeping tests fast by mocking external boundaries (databases, HTTP clients, etc.). -Learn more in the [Sociable Unit Testing guide](/docs/guides/sociable). +Learn more in the [Sociable Unit Testing guide](/docs/guides/sociable/). ::: ## How It Works: No Modules, No Bootstrapping @@ -268,13 +268,13 @@ const { unit, unitRef } = await TestBed.solitary(UserService).compile(); **The result:** Tests run 20-100x faster while remaining type-safe and maintainable. -**Deep dive:** [Virtual Test Container Guide](/docs/guides/virtual-test-container) +**Deep dive:** [Virtual Test Container Guide](/docs/guides/virtual-test-container/) ## What's Next? -- [Unit Testing Fundamentals](/docs/guides/fundamentals) - Learn about the core principles of unit testing -- [Test Doubles](/docs/guides/test-doubles) - Understand how to work with mocks, stubs, and other test doubles -- [Solitary Unit Testing](/docs/guides/solitary) - Dive deeper into testing components in complete isolation -- [Sociable Unit Testing](/docs/guides/sociable) - Explore testing with real implementations of select dependencies +- [Unit Testing Fundamentals](/docs/guides/fundamentals/) - Learn about the core principles of unit testing +- [Test Doubles](/docs/guides/test-doubles/) - Understand how to work with mocks, stubs, and other test doubles +- [Solitary Unit Testing](/docs/guides/solitary/) - Dive deeper into testing components in complete isolation +- [Sociable Unit Testing](/docs/guides/sociable/) - Explore testing with real implementations of select dependencies Need help? Join the [Suites community on GitHub Discussions](https://github.com/suites-dev/suites/discussions) or report issues on our [GitHub repository](https://github.com/suites-dev/suites). diff --git a/docs/get-started/why-suites.md b/docs/get-started/why-suites.md index 253bb26..1fd911d 100644 --- a/docs/get-started/why-suites.md +++ b/docs/get-started/why-suites.md @@ -180,7 +180,7 @@ isolated unit testing environment with type-safe test doubles. No boilerplate, n **Not using dependency injection?** Use `mock()` and `stub()` for type-safe mocking. Works with any TypeScript code, but requires manual dependency wiring -and reference tracking. See [mock() and stub() utilities](/docs/api-reference/mock). +and reference tracking. See [mock() and stub() utilities](/docs/api-reference/mock/). ::: ```typescript title="order.service.spec.ts" {1,9,11-13} @@ -279,4 +279,4 @@ Suites replaces thousands of lines of brittle, manual test setup with a single, confidence in their unit testing, improve refactor safety with solitary and sociable unit tests, and enable both developers and AI tools to write and maintain reliable test suites. -**Ready to try it?** Check out the [Quick Start](/docs/get-started/quickstart) guide to write the first test in 5 minutes. +**Ready to try it?** Check out the [Quick Start](/docs/get-started/quickstart/) guide to write the first test in 5 minutes. diff --git a/docs/guides/fundamentals.md b/docs/guides/fundamentals.md index 456f8a6..c46e308 100644 --- a/docs/guides/fundamentals.md +++ b/docs/guides/fundamentals.md @@ -158,11 +158,11 @@ Suites supports two approaches based on [Martin Fowler's distinction between solitary and sociable unit tests](https://martinfowler.com/bliki/UnitTest.html): * **Solitary Unit Tests** - Test one class in complete isolation. All collaborators are replaced with test doubles to ensure a fault in a dependency does not cause the primary class's tests to fail. \ -See [Solitary Unit Tests](/docs/guides/solitary) for examples and usage. +See [Solitary Unit Tests](/docs/guides/solitary/) for examples and usage. * **Sociable Unit Tests** - Test multiple component classes together with their real collaborators. External I/O (databases, APIs, file systems) is replaced with test doubles (mocks and stubs) to keep tests fast and deterministic. \ -See [Sociable Unit Tests](/docs/guides/sociable) for examples and usage. +See [Sociable Unit Tests](/docs/guides/sociable/) for examples and usage. Suites follows Fowler's pragmatic approach: use test doubles when collaboration is awkward (external services, I/O), but allow real collaborators when interactions are fast and stable. @@ -179,17 +179,17 @@ Suites follows Fowler's pragmatic approach: use test doubles when collaboration |---------------------|--------------------------------------------------------------------------------------|-------------------------------------------| | Unit Test | Verifies individual components in isolation | [See above](#what-is-unit-testing) | | Integration Test | Tests how multiple components work together with real external systems including I/O | N/A - Suites focuses on unit testing | -| Solitary Test | Unit test with all dependencies mocked | [Solitary Guide](/docs/guides/solitary) | -| Sociable Test | Unit test with selected real dependencies, external I/O mocked | [Sociable Guide](/docs/guides/sociable) | +| Solitary Test | Unit test with all dependencies mocked | [Solitary Guide](/docs/guides/solitary/) | +| Sociable Test | Unit test with selected real dependencies, external I/O mocked | [Sociable Guide](/docs/guides/sociable/) | | Dependency | A collaborator object that a component needs to function | Soon | ## Next Steps Now that you understand the fundamentals of unit testing with Suites, explore specific testing approaches: -- **[Solitary Unit Testing](/docs/guides/solitary)**: Write tests with complete isolation using automatic mocking -- **[Sociable Unit Testing](/docs/guides/sociable)**: Test multiple classes together with controlled collaboration -- **[Test Doubles in Suites](/docs/guides/test-doubles)**: Learn about mocks, stubs, spies, and when to use each +- **[Solitary Unit Testing](/docs/guides/solitary/)**: Write tests with complete isolation using automatic mocking +- **[Sociable Unit Testing](/docs/guides/sociable/)**: Test multiple classes together with controlled collaboration +- **[Test Doubles in Suites](/docs/guides/test-doubles/)**: Learn about mocks, stubs, spies, and when to use each ## Additional Resources diff --git a/docs/guides/index.md b/docs/guides/index.md index e0ca6be..2f31cf6 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -14,16 +14,16 @@ Practical guides for writing solitary and sociable unit tests with Suites. Learn ### In This Section -- [**Fundamentals of Unit Testing**](/docs/guides/fundamentals) - Core principles and best practices -- [**Solitary Unit Tests**](/docs/guides/solitary) - Testing components in complete isolation -- [**Sociable Unit Tests**](/docs/guides/sociable) - Testing with real dependencies -- [**Test Doubles**](/docs/guides/test-doubles) - Mocks, stubs, and spies -- [**Virtual Test Container**](/docs/guides/virtual-test-container) - How Suites creates test environments +- [**Fundamentals of Unit Testing**](/docs/guides/fundamentals/) - Core principles and best practices +- [**Solitary Unit Tests**](/docs/guides/solitary/) - Testing components in complete isolation +- [**Sociable Unit Tests**](/docs/guides/sociable/) - Testing with real dependencies +- [**Test Doubles**](/docs/guides/test-doubles/) - Mocks, stubs, and spies +- [**Virtual Test Container**](/docs/guides/virtual-test-container/) - How Suites creates test environments :::tip -Start with [Fundamentals](/docs/guides/fundamentals), then [Solitary](/docs/guides/solitary) and [Sociable](/docs/guides/sociable) testing. +Start with [Fundamentals](/docs/guides/fundamentals/), then [Solitary](/docs/guides/solitary/) and [Sociable](/docs/guides/sociable/) testing. ::: :::tip Working Examples diff --git a/docs/guides/sociable.md b/docs/guides/sociable.md index 29af047..706deab 100644 --- a/docs/guides/sociable.md +++ b/docs/guides/sociable.md @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'; > **What this covers:** Testing real component (class) interactions while controlling external dependencies \ > **Time to read:** ~15 minutes \ -> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals), [Solitary Unit Tests](/docs/guides/solitary/), [Test Doubles](/docs/guides/test-doubles/) \ +> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals/), [Solitary Unit Tests](/docs/guides/solitary/), [Test Doubles](/docs/guides/test-doubles/) \ > **Best for:** Verifying components (classes) work together correctly, catching integration bugs while maintaining test speed Sociable unit tests verify how components interact with their real dependencies while keeping external I/O operations under control. This approach identifies bugs in how business logic components work together - bugs that solitary tests miss. @@ -19,7 +19,7 @@ Sociable unit tests verify how components interact with their real dependencies ## Sociable Tests Are Unit Tests Sociable tests are **unit tests**, not integration tests. They keep external I/O (databases, APIs, file systems) mocked to stay fast and side-effect-free. The integration bugs they catch are issues in how business logic components work with each other - not issues with real external systems. \ -For the distinction, see [Unit Testing Fundamentals: Quick Reference](/docs/guides/fundamentals#quick-reference). +For the distinction, see [Unit Testing Fundamentals: Quick Reference](/docs/guides/fundamentals/#quick-reference). ## Overview @@ -217,7 +217,7 @@ describe('OrderService', () => { ``` :::tip Understanding the Control Boundary -Suites can only control **explicit dependencies** (passed through constructors). It cannot control implicit dependencies (direct imports). For more, see [Test Doubles](/docs/guides/test-doubles). +Suites can only control **explicit dependencies** (passed through constructors). It cannot control implicit dependencies (direct imports). For more, see [Test Doubles](/docs/guides/test-doubles/). ::: ## Step 4: Choose When to Configure Mocks diff --git a/docs/guides/solitary.md b/docs/guides/solitary.md index 91e3c4c..6411dcd 100644 --- a/docs/guides/solitary.md +++ b/docs/guides/solitary.md @@ -8,7 +8,7 @@ description: Testing in isolation with Suites > **What this covers:** Writing unit tests that isolate a single component (class) using automatic mocking \ > **Time to read:** ~8 minutes \ -> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals), [Test Doubles](/docs/guides/test-doubles/) \ +> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals/), [Test Doubles](/docs/guides/test-doubles/) \ > **Best for:** Testing component logic in complete isolation, controlling all inputs for predictable results Solitary unit tests evaluate a single unit of work in complete isolation from its external dependencies. These tests use @@ -21,7 +21,7 @@ collaborators. - Controlling all inputs to ensure predictable test results - Developing new components and ensuring they work correctly in isolation -In contrast to [sociable unit tests](/docs/guides/sociable), where certain dependencies are real implementations, solitary tests replace all dependencies with mocks to ensure true isolation. +In contrast to [sociable unit tests](/docs/guides/sociable/), where certain dependencies are real implementations, solitary tests replace all dependencies with mocks to ensure true isolation. ## Terminology @@ -31,9 +31,9 @@ Before diving in, it is important to understand these core concepts: * **Stub:** An individual method that returns predefined values. Configure stubs using `.mockResolvedValue()` or `.mockReturnValue()` (like `jest.fn()`). * **Mock:** A replacement for a dependency class where all methods are stubs - simply a collection of stubs -* **`Mocked:`** A type representing a class where all methods are stubs ([see `Mocked` type](/docs/api-reference/types#mockedt)). +* **`Mocked:`** A type representing a class where all methods are stubs ([see `Mocked` type](/docs/api-reference/types/#mockedt)). -For a deeper understanding of test doubles, see [Test Doubles](/docs/guides/test-doubles) after completing this guide. +For a deeper understanding of test doubles, see [Test Doubles](/docs/guides/test-doubles/) after completing this guide. ## Overview @@ -127,7 +127,7 @@ database.saveUser.mockResolvedValue(42); ``` :::info How This Works -See [Virtual Test Container](/docs/guides/virtual-test-container) for how the virtual test container works under the hood. +See [Virtual Test Container](/docs/guides/virtual-test-container/) for how the virtual test container works under the hood. ::: ## Step 3: Configure Mock Behavior @@ -149,7 +149,7 @@ it('test case', () => { ``` :::info -For advanced configuration options, see [Mock Configuration](/docs/api-reference/mock-configuration). +For advanced configuration options, see [Mock Configuration](/docs/api-reference/mock-configuration/). ::: ## Summary @@ -165,12 +165,12 @@ For advanced configuration options, see [Mock Configuration](/docs/api-reference For testing how components work together, explore different approaches: -- **[Sociable Unit Tests](/docs/guides/sociable)**: Test multiple classes together with controlled collaboration -- **[Test Doubles](/docs/guides/test-doubles)**: Understand mocks, stubs, and spies in depth +- **[Sociable Unit Tests](/docs/guides/sociable/)**: Test multiple classes together with controlled collaboration +- **[Test Doubles](/docs/guides/test-doubles/)**: Understand mocks, stubs, and spies in depth ## Additional Resources - **[Suites Examples Repository](https://github.com/suites-dev/examples)**: Working examples of solitary testing patterns -- **[API Reference - TestBed.solitary](/docs/api-reference/testbed-solitary)**: Complete API documentation for TestBed.solitary() -- **[API Reference - Mock Configuration](/docs/api-reference/mock-configuration)**: Advanced mock configuration options -- **[API Reference - Types](/docs/api-reference/types)**: TypeScript type definitions including `Mocked` +- **[API Reference - TestBed.solitary](/docs/api-reference/testbed-solitary/)**: Complete API documentation for TestBed.solitary() +- **[API Reference - Mock Configuration](/docs/api-reference/mock-configuration/)**: Advanced mock configuration options +- **[API Reference - Types](/docs/api-reference/types/)**: TypeScript type definitions including `Mocked` diff --git a/docs/guides/test-doubles.md b/docs/guides/test-doubles.md index bef0b08..35f4a2c 100644 --- a/docs/guides/test-doubles.md +++ b/docs/guides/test-doubles.md @@ -11,7 +11,7 @@ keywords: [test doubles, mocks, stubs, spies, fakes, mocks vs stubs, typescript > automatically for TypeScript backends. \ > **Time to read:** ~10 minutes \ > **Prerequisites:** Familiarity with unit testing concepts. New to Suites? Start with -> the [Quickstart](/docs/get-started/quickstart). \ +> the [Quickstart](/docs/get-started/quickstart/). \ > **Best for:** Understanding the theory behind test doubles after hands-on experience with solitary testing A **test double** is a stand-in object you use in a unit test in place of a real dependency (a database, an HTTP client, @@ -58,7 +58,7 @@ That's it - `UserRepository` was generated as a mock with every method pre-stubb factory. > **Try it:** Set up Suites and write your first test in under five minutes. See -> the [Quickstart](/docs/get-started/quickstart). +> the [Quickstart](/docs/get-started/quickstart/). The rest of this guide explains how Suites uses the terms _mock_ and _stub_, which dependencies it can and can't replace, and how to choose between state and behaviour verification in practice. @@ -165,9 +165,9 @@ repo.findById.mockResolvedValue(testUser); For more details on configuration options, see: -- [Mock Configuration](/docs/api-reference/mock-configuration) - Using `.mock().final()` and `.mock().impl()` -- [Types](/docs/api-reference/types) - Details about the `Mocked` type -- [mock() function](/docs/api-reference/mock) - Creating mocks manually +- [Mock Configuration](/docs/api-reference/mock-configuration/) - Using `.mock().final()` and `.mock().impl()` +- [Types](/docs/api-reference/types/) - Details about the `Mocked` type +- [mock() function](/docs/api-reference/mock/) - Creating mocks manually ## Testing with Real Implementations @@ -184,7 +184,7 @@ const result = await unit.createUser(userData); expect(result.id).toBeDefined(); // Real database logic executed ``` -See [Sociable Unit Tests](/docs/guides/sociable) for more information. +See [Sociable Unit Tests](/docs/guides/sociable/) for more information. ## Summary diff --git a/docs/guides/virtual-test-container.md b/docs/guides/virtual-test-container.md index 308a911..92a152a 100644 --- a/docs/guides/virtual-test-container.md +++ b/docs/guides/virtual-test-container.md @@ -8,7 +8,7 @@ description: How Suites creates lightweight test environments following inversio > **What this covers:** How Suites creates lightweight test environments without full framework initialization \ > **Time to read:** ~10 minutes \ -> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals) \ +> **Prerequisites:** [Unit Testing Fundamentals](/docs/guides/fundamentals/) \ > **Best for:** Understanding how Suites achieves speed and type safety under the hood The Virtual Test Container is the engine that drives Suites' testing capabilities. It analyzes classes to understand @@ -206,5 +206,5 @@ This separation happens automatically. The Virtual Test Container uses token inj Explore how to use the Virtual Test Container in different testing scenarios: -- **[Solitary Unit Tests](/docs/guides/solitary)**: Use the virtual container for complete isolation with automatic mocking -- **[Sociable Unit Tests](/docs/guides/sociable)**: Use `.expose()` for controlled collaboration +- **[Solitary Unit Tests](/docs/guides/solitary/)**: Use the virtual container for complete isolation with automatic mocking +- **[Sociable Unit Tests](/docs/guides/sociable/)**: Use `.expose()` for controlled collaboration diff --git a/docs/migration-guides/from-automock.md b/docs/migration-guides/from-automock.md index f1de56e..370fe12 100644 --- a/docs/migration-guides/from-automock.md +++ b/docs/migration-guides/from-automock.md @@ -21,7 +21,7 @@ in Suites, starting from version `3.0.0`. This guide covers the migration process from Automock to Suites, including dependency updates, API changes, and new features. -For detailed setup instructions, see the [Installation Guide](/docs/get-started/installation). +For detailed setup instructions, see the [Installation Guide](/docs/get-started/installation/). ## The Shift from Automock @@ -54,7 +54,7 @@ manually or understand a specific transformation. Replace Automock dependencies with Suites equivalents. -See [Installation Guide](/docs/get-started/installation) for detailed adapter information: +See [Installation Guide](/docs/get-started/installation/) for detailed adapter information: ```bash # Remove Automock packages @@ -165,10 +165,10 @@ const {unit} = await TestBed.solitary(Service).compile(); ``` **`TestBed.create()` is now `TestBed.solitary()`**: This change supports the distinction between solitary and sociable -testing approaches. See [Solitary API](/docs/api-reference/testbed-solitary). +testing approaches. See [Solitary API](/docs/api-reference/testbed-solitary/). * **New `.sociable()` method**: Added to the TestBed API for testing with real implementations of select dependencies. - See [Sociable API](/docs/api-reference/testbed-sociable). + See [Sociable API](/docs/api-reference/testbed-sociable/). * **Unified TestBed import**: TestBed is now exported from `@suites/unit` regardless of the installed adapters. Instead of importing from `@automock/jest` or `@automock/sinon`, now import from `@suites/unit`. @@ -183,15 +183,15 @@ testing approaches. See [Solitary API](/docs/api-reference/testbed-solitary). like `jest.fn()` or `sinon.stub()`. - `.mock.final` is similar but without stubs and cannot be retrieved from the unit reference. -See [Mock Configuration API](/docs/api-reference/mock-configuration) for complete details. +See [Mock Configuration API](/docs/api-reference/mock-configuration/) for complete details. ### New Features - **Support for Vitest and ESM**: Suites now supports Vitest and ECMAScript Modules (ESM). - **Sociable Unit Testing**: Test with real implementations of selected dependencies. - See [Sociable Unit Tests](/docs/guides/sociable). + See [Sociable Unit Tests](/docs/guides/sociable/). - **Enhanced Type Safety**: Improved TypeScript support with the `Mocked` type. - See [Types API](/docs/api-reference/types). + See [Types API](/docs/api-reference/types/). ## Troubleshooting Common Migration Issues @@ -204,7 +204,7 @@ Errors like `TypeError: Cannot read properties of undefined (reading 'get')` ind Type errors with mocked dependencies require using the new `Mocked` type from `@suites/unit`. -See [Types API Reference](/docs/api-reference/types) for details: +See [Types API Reference](/docs/api-reference/types/) for details: ```typescript // Before @@ -225,7 +225,7 @@ let userRepo: Mocked; Errors about missing dependencies indicate that adapter packages need installation. -See [Installation Guide](/docs/get-started/installation#supported-libraries-adapters) for the complete list of adapters. +See [Installation Guide](/docs/get-started/installation/#supported-libraries-adapters) for the complete list of adapters. ## Looking for old Automock internals? diff --git a/docs/migration-guides/index.md b/docs/migration-guides/index.md index 35f0a6a..183b08b 100644 --- a/docs/migration-guides/index.md +++ b/docs/migration-guides/index.md @@ -10,7 +10,7 @@ Guides for migrating to Suites from other testing frameworks or upgrading betwee ## Available Guides -### [From Automock](/docs/migration-guides/from-automock) +### [From Automock](/docs/migration-guides/from-automock/) Migrate from Automock to Suites with step-by-step instructions and API mapping. ## Future Guides