@khanacademy/wonder-blocks-testing 7.1.8 → 7.1.10
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 +19 -0
- package/dist/index.js.flow +1 -1
- package/package.json +5 -5
- package/src/__tests__/mock-requester.test.js +2 -2
- package/src/__tests__/respond-with.test.js +2 -2
- package/src/__tests__/response-impl.test.js +2 -2
- package/src/__tests__/settle-controller.test.js +2 -2
- package/src/__tests__/settle-signal.test.js +1 -1
- package/src/fetch/__tests__/fetch-request-matches-mock.test.js +1 -1
- package/src/fetch/__tests__/mock-fetch.test.js +2 -2
- package/src/fetch/fetch-request-matches-mock.js +1 -1
- package/src/fetch/mock-fetch.js +3 -3
- package/src/fetch/types.js +1 -1
- package/src/fixtures/__tests__/fixtures.test.js +1 -1
- package/src/fixtures/fixtures.basic.stories.js +1 -1
- package/src/fixtures/fixtures.defaultwrapper.stories.js +1 -1
- package/src/fixtures/fixtures.js +1 -1
- package/src/gql/__tests__/gql-request-matches-mock.test.js +1 -1
- package/src/gql/__tests__/mock-gql-fetch.test.js +2 -2
- package/src/gql/__tests__/wb-data-integration.test.js +2 -2
- package/src/gql/gql-request-matches-mock.js +1 -1
- package/src/gql/mock-gql-fetch.js +3 -3
- package/src/gql/types.js +2 -2
- package/src/harness/__tests__/hook-harness.test.js +8 -8
- package/src/harness/__tests__/make-hook-harness.test.js +2 -2
- package/src/harness/__tests__/make-test-harness.test.js +3 -3
- package/src/harness/__tests__/render-adapters.test.js +2 -2
- package/src/harness/__tests__/test-harness.test.js +8 -8
- package/src/harness/__tests__/types.flowtest.js +1 -1
- package/src/harness/adapters/__tests__/css.test.js +1 -1
- package/src/harness/adapters/__tests__/data.test.js +1 -1
- package/src/harness/adapters/__tests__/portal.test.js +1 -1
- package/src/harness/adapters/__tests__/router.test.js +1 -1
- package/src/harness/adapters/adapters.js +5 -5
- package/src/harness/adapters/css.js +1 -1
- package/src/harness/adapters/data.js +1 -1
- package/src/harness/adapters/portal.js +1 -1
- package/src/harness/adapters/router.js +1 -1
- package/src/harness/hook-harness.js +3 -3
- package/src/harness/make-hook-harness.js +2 -2
- package/src/harness/make-test-harness.js +2 -2
- package/src/harness/render-adapters.js +1 -1
- package/src/harness/test-harness.js +3 -3
- package/src/index.js +15 -19
- package/src/mock-requester.js +2 -2
- package/src/respond-with.js +3 -3
- package/src/settle-controller.js +1 -1
- package/src/types.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-testing
|
|
2
2
|
|
|
3
|
+
## 7.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 91cb727c: Update wonder-stuff dependencies
|
|
8
|
+
- 91cb727c: Remove file extensions from imports
|
|
9
|
+
- Updated dependencies [91cb727c]
|
|
10
|
+
- Updated dependencies [91cb727c]
|
|
11
|
+
- Updated dependencies [91cb727c]
|
|
12
|
+
- @khanacademy/wonder-blocks-data@10.1.0
|
|
13
|
+
|
|
14
|
+
## 7.1.9
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 1a5624d4: Update wonder-stuff dependencies to use newly published packages after migrating wonder-stuff to TypeScript
|
|
19
|
+
- Updated dependencies [1a5624d4]
|
|
20
|
+
- @khanacademy/wonder-blocks-data@10.0.5
|
|
21
|
+
|
|
3
22
|
## 7.1.8
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js.flow
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
export * from "../src/index
|
|
2
|
+
export * from "../src/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-testing",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.10",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@khanacademy/wonder-blocks-data": "^10.0
|
|
17
|
+
"@khanacademy/wonder-blocks-data": "^10.1.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@khanacademy/wonder-stuff-core": "^
|
|
21
|
-
"@khanacademy/wonder-stuff-testing": "^
|
|
20
|
+
"@khanacademy/wonder-stuff-core": "^1.2.1",
|
|
21
|
+
"@khanacademy/wonder-stuff-testing": "^2.3.2",
|
|
22
22
|
"@storybook/addon-actions": "^6.4.8",
|
|
23
23
|
"node-fetch": "^2.6.7",
|
|
24
24
|
"aphrodite": "^1.2.5",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-router-dom": "5.3.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"wb-dev-build-settings": "^0.7.
|
|
29
|
+
"wb-dev-build-settings": "^0.7.1"
|
|
30
30
|
},
|
|
31
31
|
"author": "",
|
|
32
32
|
"license": "MIT"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {RespondWith} from "../respond-with
|
|
3
|
-
import {mockRequester} from "../mock-requester
|
|
2
|
+
import {RespondWith} from "../respond-with";
|
|
3
|
+
import {mockRequester} from "../mock-requester";
|
|
4
4
|
|
|
5
5
|
describe("#mockRequester", () => {
|
|
6
6
|
it("should return a function", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {SettleController} from "../settle-controller
|
|
3
|
-
import {RespondWith} from "../respond-with
|
|
2
|
+
import {SettleController} from "../settle-controller";
|
|
3
|
+
import {RespondWith} from "../respond-with";
|
|
4
4
|
|
|
5
5
|
describe("RespondWith", () => {
|
|
6
6
|
describe("#text.toPromise", () => {
|
|
@@ -24,7 +24,7 @@ describe("ResponseImpl", () => {
|
|
|
24
24
|
// Act
|
|
25
25
|
const {ResponseImpl: result, NodeFetchResponse} =
|
|
26
26
|
wst.jest.isolateModules(() => ({
|
|
27
|
-
ResponseImpl: require("../response-impl
|
|
27
|
+
ResponseImpl: require("../response-impl").ResponseImpl,
|
|
28
28
|
NodeFetchResponse: require("node-fetch").Response,
|
|
29
29
|
}));
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@ describe("ResponseImpl", () => {
|
|
|
38
38
|
|
|
39
39
|
// Act
|
|
40
40
|
const result = wst.jest.isolateModules(
|
|
41
|
-
() => require("../response-impl
|
|
41
|
+
() => require("../response-impl").ResponseImpl,
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
// Assert
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {SettleController} from "../settle-controller
|
|
3
|
-
import {SettleSignal} from "../settle-signal
|
|
2
|
+
import {SettleController} from "../settle-controller";
|
|
3
|
+
import {SettleSignal} from "../settle-signal";
|
|
4
4
|
|
|
5
5
|
describe("SettleController", () => {
|
|
6
6
|
it("should have a signal", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import {Request} from "node-fetch";
|
|
3
|
-
import {fetchRequestMatchesMock} from "../fetch-request-matches-mock
|
|
3
|
+
import {fetchRequestMatchesMock} from "../fetch-request-matches-mock";
|
|
4
4
|
|
|
5
5
|
const TEST_URL = "http://example.com/foo?querya=1&queryb=elephants#fragment";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import {Request} from "node-fetch";
|
|
3
|
-
import {RespondWith} from "../../respond-with
|
|
4
|
-
import {mockFetch} from "../mock-fetch
|
|
3
|
+
import {RespondWith} from "../../respond-with";
|
|
4
|
+
import {mockFetch} from "../mock-fetch";
|
|
5
5
|
|
|
6
6
|
describe("#mockFetch", () => {
|
|
7
7
|
it.each`
|
package/src/fetch/mock-fetch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {fetchRequestMatchesMock} from "./fetch-request-matches-mock
|
|
3
|
-
import {mockRequester} from "../mock-requester
|
|
4
|
-
import type {FetchMockFn, FetchMockOperation} from "./types
|
|
2
|
+
import {fetchRequestMatchesMock} from "./fetch-request-matches-mock";
|
|
3
|
+
import {mockRequester} from "../mock-requester";
|
|
4
|
+
import type {FetchMockFn, FetchMockOperation} from "./types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A mock for the fetch function passed to GqlRouter.
|
package/src/fetch/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {render, screen} from "@testing-library/react";
|
|
4
4
|
import * as AddonActionsModule from "@storybook/addon-actions";
|
|
5
|
-
import {fixtures} from "../fixtures
|
|
5
|
+
import {fixtures} from "../fixtures";
|
|
6
6
|
|
|
7
7
|
jest.mock("@storybook/addon-actions");
|
|
8
8
|
|
package/src/fixtures/fixtures.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as React from "react";
|
|
|
3
3
|
import {render, screen, waitFor} from "@testing-library/react";
|
|
4
4
|
|
|
5
5
|
import {GqlRouter, useGql} from "@khanacademy/wonder-blocks-data";
|
|
6
|
-
import {RespondWith} from "../../respond-with
|
|
7
|
-
import {mockGqlFetch} from "../mock-gql-fetch
|
|
6
|
+
import {RespondWith} from "../../respond-with";
|
|
7
|
+
import {mockGqlFetch} from "../mock-gql-fetch";
|
|
8
8
|
|
|
9
9
|
describe("#mockGqlFetch", () => {
|
|
10
10
|
describe("with GqlRouter and useGql", () => {
|
|
@@ -3,8 +3,8 @@ import * as React from "react";
|
|
|
3
3
|
import {render, screen, waitFor} from "@testing-library/react";
|
|
4
4
|
|
|
5
5
|
import {GqlRouter, useGql} from "@khanacademy/wonder-blocks-data";
|
|
6
|
-
import {RespondWith} from "../../respond-with
|
|
7
|
-
import {mockGqlFetch} from "../mock-gql-fetch
|
|
6
|
+
import {RespondWith} from "../../respond-with";
|
|
7
|
+
import {mockGqlFetch} from "../mock-gql-fetch";
|
|
8
8
|
|
|
9
9
|
describe("integrating mockGqlFetch, RespondWith, GqlRouter and useGql", () => {
|
|
10
10
|
it("should reject with error indicating there are no mocks", async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import type {GqlOperation, GqlContext} from "@khanacademy/wonder-blocks-data";
|
|
3
|
-
import type {GqlMockOperation} from "./types
|
|
3
|
+
import type {GqlMockOperation} from "./types";
|
|
4
4
|
|
|
5
5
|
const safeHasOwnProperty = (obj: any, prop: string): boolean =>
|
|
6
6
|
// Flow really shouldn't be raising this error here.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {gqlRequestMatchesMock} from "./gql-request-matches-mock
|
|
3
|
-
import {mockRequester} from "../mock-requester
|
|
4
|
-
import type {GqlFetchMockFn, GqlMockOperation} from "./types
|
|
2
|
+
import {gqlRequestMatchesMock} from "./gql-request-matches-mock";
|
|
3
|
+
import {mockRequester} from "../mock-requester";
|
|
4
|
+
import type {GqlFetchMockFn, GqlMockOperation} from "./types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A mock for the fetch function passed to GqlRouter.
|
package/src/gql/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//@flow
|
|
2
2
|
import type {GqlOperation, GqlContext} from "@khanacademy/wonder-blocks-data";
|
|
3
|
-
import type {GraphQLJson} from "../types
|
|
4
|
-
import type {MockResponse} from "../respond-with
|
|
3
|
+
import type {GraphQLJson} from "../types";
|
|
4
|
+
import type {MockResponse} from "../respond-with";
|
|
5
5
|
|
|
6
6
|
export type GqlMockOperation<
|
|
7
7
|
TData: {...},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import {jest as ws} from "@khanacademy/wonder-stuff-testing";
|
|
3
|
-
import * as MHH from "../make-hook-harness
|
|
4
|
-
import {DefaultAdapters, DefaultConfigs} from "../adapters/adapters
|
|
3
|
+
import * as MHH from "../make-hook-harness";
|
|
4
|
+
import {DefaultAdapters, DefaultConfigs} from "../adapters/adapters";
|
|
5
5
|
|
|
6
|
-
jest.mock("../make-hook-harness
|
|
6
|
+
jest.mock("../make-hook-harness", () => {
|
|
7
7
|
const returnValueFake = {
|
|
8
8
|
thisisa: "PRETEND REACT COMPONENT",
|
|
9
9
|
};
|
|
@@ -21,7 +21,7 @@ describe("#hookHarness", () => {
|
|
|
21
21
|
const makeHookHarnessSpy = jest.spyOn(MHH, "makeHookHarness");
|
|
22
22
|
|
|
23
23
|
// Act
|
|
24
|
-
await ws.isolateModules(() => import("../hook-harness
|
|
24
|
+
await ws.isolateModules(() => import("../hook-harness"));
|
|
25
25
|
|
|
26
26
|
// Assert
|
|
27
27
|
expect(makeHookHarnessSpy).toHaveBeenCalledWith(
|
|
@@ -38,8 +38,8 @@ describe("#hookHarness", () => {
|
|
|
38
38
|
// $FlowIgnore[prop-missing] - we add this into our mock at the top.
|
|
39
39
|
const [{harnessFake}, {hookHarness}] = await ws.isolateModules(() =>
|
|
40
40
|
Promise.all([
|
|
41
|
-
import("../make-hook-harness
|
|
42
|
-
import("../hook-harness
|
|
41
|
+
import("../make-hook-harness"),
|
|
42
|
+
import("../hook-harness"),
|
|
43
43
|
]),
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -58,8 +58,8 @@ describe("#hookHarness", () => {
|
|
|
58
58
|
// $FlowIgnore[prop-missing] - we add this into our mock at the top.
|
|
59
59
|
const [{returnValueFake}, {hookHarness}] = await ws.isolateModules(() =>
|
|
60
60
|
Promise.all([
|
|
61
|
-
import("../make-hook-harness
|
|
62
|
-
import("../hook-harness
|
|
61
|
+
import("../make-hook-harness"),
|
|
62
|
+
import("../hook-harness"),
|
|
63
63
|
]),
|
|
64
64
|
);
|
|
65
65
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {render} from "@testing-library/react";
|
|
4
|
-
import {makeHookHarness} from "../make-hook-harness
|
|
5
|
-
import * as MTH from "../make-test-harness
|
|
4
|
+
import {makeHookHarness} from "../make-hook-harness";
|
|
5
|
+
import * as MTH from "../make-test-harness";
|
|
6
6
|
|
|
7
7
|
describe("#makeHookHarness", () => {
|
|
8
8
|
it("should call makeTestHarness", () => {
|
|
@@ -3,9 +3,9 @@ import * as React from "react";
|
|
|
3
3
|
import {Route} from "react-router-dom";
|
|
4
4
|
import {render} from "@testing-library/react";
|
|
5
5
|
|
|
6
|
-
import * as RA from "../render-adapters
|
|
7
|
-
import {makeTestHarness} from "../make-test-harness
|
|
8
|
-
import {DefaultConfigs, DefaultAdapters} from "../adapters/adapters
|
|
6
|
+
import * as RA from "../render-adapters";
|
|
7
|
+
import {makeTestHarness} from "../make-test-harness";
|
|
8
|
+
import {DefaultConfigs, DefaultAdapters} from "../adapters/adapters";
|
|
9
9
|
|
|
10
10
|
describe("#makeTestHarness", () => {
|
|
11
11
|
it("should return a function", () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import {renderAdapters} from "../render-adapters
|
|
3
|
+
import {renderAdapters} from "../render-adapters";
|
|
4
4
|
|
|
5
|
-
import type {TestHarnessAdapter, TestHarnessConfigs} from "../types
|
|
5
|
+
import type {TestHarnessAdapter, TestHarnessConfigs} from "../types";
|
|
6
6
|
|
|
7
7
|
describe("#renderAdapters", () => {
|
|
8
8
|
it("should return children if no adapters", () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import {jest as ws} from "@khanacademy/wonder-stuff-testing";
|
|
3
|
-
import * as MTH from "../make-test-harness
|
|
4
|
-
import {DefaultAdapters, DefaultConfigs} from "../adapters/adapters
|
|
3
|
+
import * as MTH from "../make-test-harness";
|
|
4
|
+
import {DefaultAdapters, DefaultConfigs} from "../adapters/adapters";
|
|
5
5
|
|
|
6
|
-
jest.mock("../make-test-harness
|
|
6
|
+
jest.mock("../make-test-harness", () => {
|
|
7
7
|
const returnValueFake = {
|
|
8
8
|
thisisa: "PRETEND REACT COMPONENT",
|
|
9
9
|
};
|
|
@@ -21,7 +21,7 @@ describe("#testHarness", () => {
|
|
|
21
21
|
const makeTestHarnessSpy = jest.spyOn(MTH, "makeTestHarness");
|
|
22
22
|
|
|
23
23
|
// Act
|
|
24
|
-
await ws.isolateModules(() => import("../hook-harness
|
|
24
|
+
await ws.isolateModules(() => import("../hook-harness"));
|
|
25
25
|
|
|
26
26
|
// Assert
|
|
27
27
|
expect(makeTestHarnessSpy).toHaveBeenCalledWith(
|
|
@@ -39,8 +39,8 @@ describe("#testHarness", () => {
|
|
|
39
39
|
// $FlowIgnore[prop-missing] - we add this into our mock at the top.
|
|
40
40
|
const [{harnessFake}, {testHarness}] = await ws.isolateModules(() =>
|
|
41
41
|
Promise.all([
|
|
42
|
-
import("../make-test-harness
|
|
43
|
-
import("../test-harness
|
|
42
|
+
import("../make-test-harness"),
|
|
43
|
+
import("../test-harness"),
|
|
44
44
|
]),
|
|
45
45
|
);
|
|
46
46
|
|
|
@@ -60,8 +60,8 @@ describe("#testHarness", () => {
|
|
|
60
60
|
// $FlowIgnore[prop-missing] - we add this into our mock at the top.
|
|
61
61
|
const [{returnValueFake}, {testHarness}] = await ws.isolateModules(() =>
|
|
62
62
|
Promise.all([
|
|
63
|
-
import("../make-test-harness
|
|
64
|
-
import("../test-harness
|
|
63
|
+
import("../make-test-harness"),
|
|
64
|
+
import("../test-harness"),
|
|
65
65
|
]),
|
|
66
66
|
);
|
|
67
67
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {render, screen, waitFor} from "@testing-library/react";
|
|
4
4
|
import {useCachedEffect} from "@khanacademy/wonder-blocks-data";
|
|
5
|
-
import * as Data from "../data
|
|
5
|
+
import * as Data from "../data";
|
|
6
6
|
|
|
7
7
|
describe("WonderBlocksData.adapter", () => {
|
|
8
8
|
it("should render children when configuration arrays are empty", () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {withRouter, Prompt} from "react-router-dom";
|
|
4
4
|
import {render} from "@testing-library/react";
|
|
5
|
-
import * as Router from "../router
|
|
5
|
+
import * as Router from "../router";
|
|
6
6
|
|
|
7
7
|
describe("Router.adapter", () => {
|
|
8
8
|
it("should throw if the config does not match any expecations", () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import * as css from "./css
|
|
3
|
-
import * as data from "./data
|
|
4
|
-
import * as portal from "./portal
|
|
5
|
-
import * as router from "./router
|
|
2
|
+
import * as css from "./css";
|
|
3
|
+
import * as data from "./data";
|
|
4
|
+
import * as portal from "./portal";
|
|
5
|
+
import * as router from "./router";
|
|
6
6
|
|
|
7
|
-
import type {TestHarnessConfigs} from "../types
|
|
7
|
+
import type {TestHarnessConfigs} from "../types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* NOTE: We do not type `DefaultAdapters` with `Adapters` here because we want
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {InterceptRequests} from "@khanacademy/wonder-blocks-data";
|
|
4
|
-
import type {TestHarnessAdapter} from "../types
|
|
4
|
+
import type {TestHarnessAdapter} from "../types";
|
|
5
5
|
|
|
6
6
|
type Interceptor = React.ElementConfig<typeof InterceptRequests>["interceptor"];
|
|
7
7
|
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import {StaticRouter, MemoryRouter, Route, Switch} from "react-router-dom";
|
|
5
5
|
|
|
6
6
|
import type {LocationShape, Location} from "react-router-dom";
|
|
7
|
-
import type {TestHarnessAdapter} from "../types
|
|
7
|
+
import type {TestHarnessAdapter} from "../types";
|
|
8
8
|
|
|
9
9
|
type MemoryRouterProps = React.ElementConfig<typeof MemoryRouter>;
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import {makeHookHarness} from "./make-hook-harness
|
|
5
|
-
import {DefaultAdapters, DefaultConfigs} from "./adapters/adapters
|
|
4
|
+
import {makeHookHarness} from "./make-hook-harness";
|
|
5
|
+
import {DefaultAdapters, DefaultConfigs} from "./adapters/adapters";
|
|
6
6
|
|
|
7
|
-
import type {TestHarnessConfigs} from "./types
|
|
7
|
+
import type {TestHarnessConfigs} from "./types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Create test wrapper for hook testing with Wonder Blocks default adapters.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import {makeTestHarness} from "./make-test-harness
|
|
4
|
+
import {makeTestHarness} from "./make-test-harness";
|
|
5
5
|
|
|
6
|
-
import type {TestHarnessAdapters, TestHarnessConfigs} from "./types
|
|
6
|
+
import type {TestHarnessAdapters, TestHarnessConfigs} from "./types";
|
|
7
7
|
|
|
8
8
|
const HookHarness = ({children}) => children;
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import {renderAdapters} from "./render-adapters
|
|
4
|
+
import {renderAdapters} from "./render-adapters";
|
|
5
5
|
|
|
6
|
-
import type {TestHarnessAdapters, TestHarnessConfigs} from "./types
|
|
6
|
+
import type {TestHarnessAdapters, TestHarnessConfigs} from "./types";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Create a test harness method for use with React components.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import {makeTestHarness} from "./make-test-harness
|
|
5
|
-
import {DefaultAdapters, DefaultConfigs} from "./adapters/adapters
|
|
4
|
+
import {makeTestHarness} from "./make-test-harness";
|
|
5
|
+
import {DefaultAdapters, DefaultConfigs} from "./adapters/adapters";
|
|
6
6
|
|
|
7
|
-
import type {TestHarnessConfigs} from "./types
|
|
7
|
+
import type {TestHarnessConfigs} from "./types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Wrap a component with a test harness using Wonder Blocks default adapters.
|
package/src/index.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
// Fixtures framework
|
|
4
|
-
export {fixtures} from "./fixtures/fixtures
|
|
5
|
-
export type {
|
|
6
|
-
FixtureFn,
|
|
7
|
-
FixtureProps,
|
|
8
|
-
GetPropsOptions,
|
|
9
|
-
} from "./fixtures/types.js";
|
|
4
|
+
export {fixtures} from "./fixtures/fixtures";
|
|
5
|
+
export type {FixtureFn, FixtureProps, GetPropsOptions} from "./fixtures/types";
|
|
10
6
|
|
|
11
7
|
// Fetch mocking framework
|
|
12
|
-
export {mockFetch} from "./fetch/mock-fetch
|
|
13
|
-
export {mockGqlFetch} from "./gql/mock-gql-fetch
|
|
14
|
-
export {RespondWith} from "./respond-with
|
|
15
|
-
export {SettleController} from "./settle-controller
|
|
16
|
-
export type {MockResponse} from "./respond-with
|
|
17
|
-
export type {FetchMockFn, FetchMockOperation} from "./fetch/types
|
|
18
|
-
export type {GqlFetchMockFn, GqlMockOperation} from "./gql/types
|
|
8
|
+
export {mockFetch} from "./fetch/mock-fetch";
|
|
9
|
+
export {mockGqlFetch} from "./gql/mock-gql-fetch";
|
|
10
|
+
export {RespondWith} from "./respond-with";
|
|
11
|
+
export {SettleController} from "./settle-controller";
|
|
12
|
+
export type {MockResponse} from "./respond-with";
|
|
13
|
+
export type {FetchMockFn, FetchMockOperation} from "./fetch/types";
|
|
14
|
+
export type {GqlFetchMockFn, GqlMockOperation} from "./gql/types";
|
|
19
15
|
|
|
20
16
|
// Test harness framework
|
|
21
|
-
export * from "./harness/types
|
|
22
|
-
export * as harnessAdapters from "./harness/adapters/adapters
|
|
23
|
-
export {makeHookHarness} from "./harness/make-hook-harness
|
|
24
|
-
export {makeTestHarness} from "./harness/make-test-harness
|
|
25
|
-
export {hookHarness} from "./harness/hook-harness
|
|
26
|
-
export {testHarness} from "./harness/test-harness
|
|
17
|
+
export * from "./harness/types";
|
|
18
|
+
export * as harnessAdapters from "./harness/adapters/adapters";
|
|
19
|
+
export {makeHookHarness} from "./harness/make-hook-harness";
|
|
20
|
+
export {makeTestHarness} from "./harness/make-test-harness";
|
|
21
|
+
export {hookHarness} from "./harness/hook-harness";
|
|
22
|
+
export {testHarness} from "./harness/test-harness";
|
package/src/mock-requester.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import type {MockResponse} from "./respond-with
|
|
3
|
-
import type {OperationMock, OperationMatcher, MockFn} from "./types
|
|
2
|
+
import type {MockResponse} from "./respond-with";
|
|
3
|
+
import type {OperationMock, OperationMatcher, MockFn} from "./types";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A generic mock request function for using when mocking fetch or gqlFetch.
|
package/src/respond-with.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {SettleSignal} from "./settle-signal
|
|
3
|
-
import {ResponseImpl} from "./response-impl
|
|
4
|
-
import type {GraphQLJson} from "./types
|
|
2
|
+
import {SettleSignal} from "./settle-signal";
|
|
3
|
+
import {ResponseImpl} from "./response-impl";
|
|
4
|
+
import type {GraphQLJson} from "./types";
|
|
5
5
|
|
|
6
6
|
// We want the parameterization here so that folks can assert a response is
|
|
7
7
|
// of a specific type if passing between various functions. For example,
|
package/src/settle-controller.js
CHANGED
package/src/types.js
CHANGED