@khanacademy/wonder-blocks-testing 17.0.2 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @khanacademy/wonder-blocks-testing
2
2
 
3
+ ## 17.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b5618a5: The `router` test harness adapter now supports a data-routes mode for exercising React Router v6 data routers. Passing a `routes` config renders `createMemoryRouter` + `RouterProvider` so that route `loader`s run and `errorElement`s render (`useRouteError`/`useLoaderData`, redirects, deferred data) — unlike context mode, which only provides routing context via `MemoryRouter`/`StaticRouter`.
8
+
9
+ The mode is selected purely by config shape: pass `routes` (plus optional `initialEntries`/`initialIndex`/`hydrationData`) for data-routes mode, or a location for the existing context mode. Provide `routes` as a function `(harnessedComponent) => RouteObject[]` for full control over where the harnessed component is mounted (e.g. as an `errorElement`), or as an array to mount it as the matched leaf route's `element` (the leaf must not define its own `element`, `Component`, or `lazy`). Pass `hydrationData` to pre-resolve loaders and render synchronously. Context mode is unchanged and backward-compatible, and combining the two modes is a type error.
10
+
11
+ The router adapter's config type is now exported as `RouterAdapterConfig`.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [b5618a5]
16
+ - @khanacademy/wonder-blocks-testing-core@5.1.0
17
+ - @khanacademy/wonder-blocks-core@12.4.4
18
+ - @khanacademy/wonder-blocks-data@15.0.2
19
+
3
20
  ## 17.0.2
4
21
 
5
22
  ### Patch Changes
@@ -17,19 +17,7 @@ export declare const DefaultAdapters: {
17
17
  }>;
18
18
  readonly data: import("@khanacademy/wonder-blocks-testing-core").TestHarnessAdapter<((requestId: string) => Promise<import("@khanacademy/wonder-blocks-data").ValidCacheData> | null | undefined) | ((requestId: string) => Promise<import("@khanacademy/wonder-blocks-data").ValidCacheData> | null | undefined)[]>;
19
19
  readonly portal: import("@khanacademy/wonder-blocks-testing-core").TestHarnessAdapter<string>;
20
- readonly router: import("@khanacademy/wonder-blocks-testing-core").TestHarnessAdapter<string | Readonly<{
21
- initialEntries: import("history").LocationDescriptor<unknown>[] | undefined;
22
- initialIndex?: number | undefined;
23
- path?: string;
24
- } | {
25
- location: import("history").LocationDescriptor;
26
- forceStatic: true;
27
- disableCompatRouter?: boolean;
28
- path?: string;
29
- } | {
30
- location: import("history").LocationDescriptor;
31
- path?: string;
32
- }>>;
20
+ readonly router: import("@khanacademy/wonder-blocks-testing-core").TestHarnessAdapter<import("@khanacademy/wonder-blocks-testing-core").RouterAdapterConfig>;
33
21
  readonly renderState: import("@khanacademy/wonder-blocks-testing-core").TestHarnessAdapter<true>;
34
22
  };
35
23
  /**
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { mockFetch, RespondWith, SettleController, } from "@khanacademy/wonder-b
2
2
  export { mockGqlFetch } from "./gql/mock-gql-fetch";
3
3
  export type { MockResponse, FetchMockFn, FetchMockOperation, } from "@khanacademy/wonder-blocks-testing-core";
4
4
  export type { GqlFetchMockFn, GqlMockOperation } from "./gql/types";
5
- export type { TestHarnessAdapter, TestHarnessAdapters, TestHarnessConfig, TestHarnessConfigs, } from "@khanacademy/wonder-blocks-testing-core";
5
+ export type { TestHarnessAdapter, TestHarnessAdapters, TestHarnessConfig, TestHarnessConfigs, RouterAdapterConfig, } from "@khanacademy/wonder-blocks-testing-core";
6
6
  export * as harnessAdapters from "./harness/adapters";
7
7
  export { makeHookHarness, makeTestHarness, hookHarness, testHarness, } from "@khanacademy/wonder-blocks-testing-core";
8
8
  export { renderHookStatic } from "@khanacademy/wonder-blocks-testing-core";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "17.0.2",
6
+ "version": "17.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@khanacademy/wonder-blocks-core": "12.4.4",
24
24
  "@khanacademy/wonder-blocks-data": "15.0.2",
25
- "@khanacademy/wonder-blocks-testing-core": "5.0.0"
25
+ "@khanacademy/wonder-blocks-testing-core": "5.1.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@khanacademy/wonder-stuff-core": "^3.0.0",