@trackunit/react-core-contexts-test 0.1.75 → 0.1.76

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/src/debugger.d.ts CHANGED
@@ -1,36 +1,36 @@
1
- import React from "react";
2
- type PropsToWatch<P> = P extends object ? P : never;
3
- /**
4
- * Logs props that have changed.
5
- * Use this for debugging which props force a component to re-render.
6
- * This is a hook version of the class component lifecycle method `componentDidUpdate`.
7
- * ALWAYS wrap in your own object.
8
- *
9
- * @param id optional id to use for logging or it will guess the id from the stack trace
10
- * @param propsToWatch all the props to watch for changes
11
- * @example
12
- * const propsToWatch = { foo: props.foo, bar: props.bar };
13
- * useDebugger({ id: "MyComponent", propsToWatch });
14
- */
15
- export declare const useDebugger: <P extends object>({ id, propsToWatch, }: {
16
- id?: string | undefined;
17
- propsToWatch: PropsToWatch<P> | null;
18
- }) => void;
19
- /**
20
- * Debugger component for debugging state changes and re-renders.
21
- *
22
- * This component will log when it is mounted, re-renders or unmounted.
23
- * It will also log when any of its props change.
24
- *
25
- * @param id optional id to use for logging
26
- * @param stop if true, will stop execution and open debugger
27
- * @param logPropsChanges optional object with props to watch for changes
28
- * @param children the children to render
29
- */
30
- export declare const Debugger: ({ id, logPropsChanges, stop, children, }: {
31
- children: React.ReactNode;
32
- id?: string | undefined;
33
- stop?: boolean | undefined;
34
- logPropsChanges?: {} | undefined;
35
- }) => JSX.Element;
36
- export {};
1
+ import React from "react";
2
+ type PropsToWatch<P> = P extends object ? P : never;
3
+ /**
4
+ * Logs props that have changed.
5
+ * Use this for debugging which props force a component to re-render.
6
+ * This is a hook version of the class component lifecycle method `componentDidUpdate`.
7
+ * ALWAYS wrap in your own object.
8
+ *
9
+ * @param id optional id to use for logging or it will guess the id from the stack trace
10
+ * @param propsToWatch all the props to watch for changes
11
+ * @example
12
+ * const propsToWatch = { foo: props.foo, bar: props.bar };
13
+ * useDebugger({ id: "MyComponent", propsToWatch });
14
+ */
15
+ export declare const useDebugger: <P extends object>({ id, propsToWatch, }: {
16
+ id?: string | undefined;
17
+ propsToWatch: PropsToWatch<P> | null;
18
+ }) => void;
19
+ /**
20
+ * Debugger component for debugging state changes and re-renders.
21
+ *
22
+ * This component will log when it is mounted, re-renders or unmounted.
23
+ * It will also log when any of its props change.
24
+ *
25
+ * @param id optional id to use for logging
26
+ * @param stop if true, will stop execution and open debugger
27
+ * @param logPropsChanges optional object with props to watch for changes
28
+ * @param children the children to render
29
+ */
30
+ export declare const Debugger: ({ id, logPropsChanges, stop, children, }: {
31
+ children: React.ReactNode;
32
+ id?: string | undefined;
33
+ stop?: boolean | undefined;
34
+ logPropsChanges?: {} | undefined;
35
+ }) => JSX.Element;
36
+ export {};
package/src/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export * from "./debugger";
2
- export * from "./mocks/mockAnalyticsContext";
3
- export * from "./mocks/mockAssetSortingContext";
4
- export * from "./mocks/mockCurrentUserContext";
5
- export * from "./mocks/mockEnvironmentContext";
6
- export * from "./mocks/mockOemBrandingContext";
7
- export * from "./mocks/mockToastContext";
8
- export * from "./mocks/mockUserSubscriptionContext";
9
- export * from "./TrackunitProvidersMockBuilder";
10
- export * from "./utils/doNothing";
11
- export * from "./utils/queryFor";
12
- export * from "./utils/validateIrisApp";
13
- export * from "./utils/wait";
1
+ export * from "./debugger";
2
+ export * from "./mocks/mockAnalyticsContext";
3
+ export * from "./mocks/mockAssetSortingContext";
4
+ export * from "./mocks/mockCurrentUserContext";
5
+ export * from "./mocks/mockEnvironmentContext";
6
+ export * from "./mocks/mockOemBrandingContext";
7
+ export * from "./mocks/mockToastContext";
8
+ export * from "./mocks/mockUserSubscriptionContext";
9
+ export * from "./TrackunitProvidersMockBuilder";
10
+ export * from "./utils/doNothing";
11
+ export * from "./utils/queryFor";
12
+ export * from "./utils/validateIrisApp";
13
+ export * from "./utils/wait";
@@ -1,2 +1,2 @@
1
- import { IAnalyticsContext } from "@trackunit/react-core-contexts-api";
2
- export declare const mockAnalyticsContext: IAnalyticsContext<{}>;
1
+ import { IAnalyticsContext } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockAnalyticsContext: IAnalyticsContext<{}>;
@@ -1,2 +1,2 @@
1
- import { IAssetSortingContext } from "@trackunit/react-core-contexts-api";
2
- export declare const mockAssetSortingContext: IAssetSortingContext;
1
+ import { IAssetSortingContext } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockAssetSortingContext: IAssetSortingContext;
@@ -1,7 +1,7 @@
1
- import { ICurrentUserContext } from "@trackunit/react-core-contexts-api";
2
- /**
3
- * Mocks the current user context
4
- *
5
- * @returns {ICurrentUserContext} - Returns the mocked current user context
6
- */
7
- export declare const mockCurrentUserContext: ICurrentUserContext;
1
+ import { ICurrentUserContext } from "@trackunit/react-core-contexts-api";
2
+ /**
3
+ * Mocks the current user context
4
+ *
5
+ * @returns {ICurrentUserContext} - Returns the mocked current user context
6
+ */
7
+ export declare const mockCurrentUserContext: ICurrentUserContext;
@@ -1,2 +1,2 @@
1
- import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
2
- export declare const mockEnvironmentContext: IEnvironmentContext;
1
+ import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockEnvironmentContext: IEnvironmentContext;
@@ -1,2 +1,2 @@
1
- import { IOemBrandingContext } from "@trackunit/react-core-contexts-api";
2
- export declare const mockOemBrandingContext: IOemBrandingContext;
1
+ import { IOemBrandingContext } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockOemBrandingContext: IOemBrandingContext;
@@ -1,2 +1,2 @@
1
- import { IToastContext } from "@trackunit/react-core-contexts-api";
2
- export declare const mockToastContext: IToastContext;
1
+ import { IToastContext } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockToastContext: IToastContext;
@@ -1,7 +1,7 @@
1
- import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
2
- /**
3
- * This is a mock for the UserSubscriptionContext.
4
- *
5
- * @returns { IUserSubscriptionContext }- mock for the UserSubscriptionContext
6
- */
7
- export declare const mockUserSubscriptionContext: IUserSubscriptionContext;
1
+ import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
2
+ /**
3
+ * This is a mock for the UserSubscriptionContext.
4
+ *
5
+ * @returns { IUserSubscriptionContext }- mock for the UserSubscriptionContext
6
+ */
7
+ export declare const mockUserSubscriptionContext: IUserSubscriptionContext;
@@ -1,4 +1,4 @@
1
- /**
2
- * Do nothing
3
- */
4
- export declare const doNothing: () => any | void;
1
+ /**
2
+ * Do nothing
3
+ */
4
+ export declare const doNothing: () => any | void;
@@ -1,18 +1,18 @@
1
- import { ApolloError } from "@apollo/client";
2
- import { MockedResponse } from "@apollo/client/testing";
3
- import { DocumentNode } from "graphql";
4
- /**
5
- *
6
- * @param document Document that represents the specific GQL query / mutation schema.
7
- * @param variables Variables that should be passed to the query / mutation.
8
- * Note that an *exact* match between the mock and operation is necessary.
9
- * @param data Data object to be returned.
10
- * Note that *all* properties should be given a value, use `null` in place of `undefined`,
11
- * otherwise nothing will be returned.
12
- * @param error ApolloError object to be returned.
13
- * @returns {MockedResponse} that can be passed to the mocked ApolloProvider.
14
- * @see [Testing React components using MockedProvider and associated APIs](https://www.apollographql.com/docs/react/development-testing/testing/)
15
- */
16
- export declare const queryFor: <Result extends {
17
- __typename?: unknown;
18
- }, Variables>(document: DocumentNode, variables: Variables, data: Result | null, error?: ApolloError | Error) => MockedResponse;
1
+ import { ApolloError } from "@apollo/client";
2
+ import { MockedResponse } from "@apollo/client/testing";
3
+ import { DocumentNode } from "graphql";
4
+ /**
5
+ *
6
+ * @param document Document that represents the specific GQL query / mutation schema.
7
+ * @param variables Variables that should be passed to the query / mutation.
8
+ * Note that an *exact* match between the mock and operation is necessary.
9
+ * @param data Data object to be returned.
10
+ * Note that *all* properties should be given a value, use `null` in place of `undefined`,
11
+ * otherwise nothing will be returned.
12
+ * @param error ApolloError object to be returned.
13
+ * @returns {MockedResponse} that can be passed to the mocked ApolloProvider.
14
+ * @see [Testing React components using MockedProvider and associated APIs](https://www.apollographql.com/docs/react/development-testing/testing/)
15
+ */
16
+ export declare const queryFor: <Result extends {
17
+ __typename?: unknown;
18
+ }, Variables>(document: DocumentNode, variables: Variables, data: Result | null, error?: ApolloError | Error) => MockedResponse;
@@ -1,21 +1,21 @@
1
- /**
2
- * This helps validate the IrisApp is exposed correctly it must expose:
3
- * - bootstrap
4
- * - mount
5
- * - unmount
6
- * According to the single spa spec.
7
- *
8
- * Your test could look like this
9
- *
10
- * @example
11
- * import * as IrisApp from "./index";
12
- describe("App", () => {
13
- it("Should validate", async () => {
14
- const result = await validateIrisApp(IrisApp);
15
- expect(result).toBeNull();
16
- });
17
- });
18
- * @param irisApp Import the index ts(x) file as above and pass it in.
19
- * @returns {null|string} if everything is good - otherwise a string telling you what is wrong.
20
- */
21
- export declare const validateIrisApp: (irisApp: any) => Promise<"Missing a bootstrap function" | "Missing a mount function" | "Missing an unmount function" | "Update must be a function" | null>;
1
+ /**
2
+ * This helps validate the IrisApp is exposed correctly it must expose:
3
+ * - bootstrap
4
+ * - mount
5
+ * - unmount
6
+ * According to the single spa spec.
7
+ *
8
+ * Your test could look like this
9
+ *
10
+ * @example
11
+ * import * as IrisApp from "./index";
12
+ describe("App", () => {
13
+ it("Should validate", async () => {
14
+ const result = await validateIrisApp(IrisApp);
15
+ expect(result).toBeNull();
16
+ });
17
+ });
18
+ * @param irisApp Import the index ts(x) file as above and pass it in.
19
+ * @returns {null|string} if everything is good - otherwise a string telling you what is wrong.
20
+ */
21
+ export declare const validateIrisApp: (irisApp: any) => Promise<"Missing a bootstrap function" | "Missing a mount function" | "Missing an unmount function" | "Update must be a function" | null>;
@@ -1,16 +1,16 @@
1
- /**
2
- * Flushes all promises in the queue.
3
- * This is useful when testing async code.
4
- *
5
- * @param waitTimeInMS - The amount of time to wait before resolving the promise.
6
- * @returns {Promise<void>} - Returns a promise that resolves after the wait time.
7
- */
8
- export declare const flushPromises: (waitTimeInMS?: number) => Promise<unknown>;
9
- /**
10
- * Flushes all promises in the queue.
11
- * This is useful when testing async code.
12
- *
13
- * @param waitTimeInMS - The amount of time to wait before resolving the promise.
14
- * @returns {Promise<void>} - Returns a promise that resolves after the wait time.
15
- */
16
- export declare const flushPromisesInAct: (waitTimeInMS?: number) => Promise<unknown>;
1
+ /**
2
+ * Flushes all promises in the queue.
3
+ * This is useful when testing async code.
4
+ *
5
+ * @param waitTimeInMS - The amount of time to wait before resolving the promise.
6
+ * @returns {Promise<void>} - Returns a promise that resolves after the wait time.
7
+ */
8
+ export declare const flushPromises: (waitTimeInMS?: number) => Promise<unknown>;
9
+ /**
10
+ * Flushes all promises in the queue.
11
+ * This is useful when testing async code.
12
+ *
13
+ * @param waitTimeInMS - The amount of time to wait before resolving the promise.
14
+ * @returns {Promise<void>} - Returns a promise that resolves after the wait time.
15
+ */
16
+ export declare const flushPromisesInAct: (waitTimeInMS?: number) => Promise<unknown>;