@trackunit/react-core-contexts-test 0.1.104 → 0.1.105

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/index.cjs2.js CHANGED
@@ -43542,6 +43542,7 @@ class TrackunitProvidersMockBuilder {
43542
43542
  this.selectedAnalyticsContext = mockAnalyticsContext;
43543
43543
  this.selectedOemBrandingContext = mockOemBrandingContext;
43544
43544
  this.selectedUserSubscriptionContext = mockUserSubscriptionContext;
43545
+ this.selectedFilterBarValues = { filterBarValues: {} };
43545
43546
  }
43546
43547
  /**
43547
43548
  * Use this Analytics Context.
@@ -43627,6 +43628,31 @@ class TrackunitProvidersMockBuilder {
43627
43628
  this.selectedCurrentUserContext = Object.assign(Object.assign({}, mockCurrentUserContext), currentUserContext);
43628
43629
  return this;
43629
43630
  }
43631
+ /**
43632
+ * Use this to pass in a differerent filter bar values when working with pages with filterbar.
43633
+ * Defaults to { filterBarValues: {} }.
43634
+ *
43635
+ * @param filterBarValues - The filter bar values to use.
43636
+ * @example
43637
+ * ...
43638
+ * it("should allow render", async () => {
43639
+ * await trackunitProviders().filterBarValues(yourFilterBarValuesMock).render(<YourTestComponent data-testid="yourTestId" />);
43640
+ * expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
43641
+ * });
43642
+ * ...
43643
+ * @example
43644
+ * ...
43645
+ * it("should allow renderHook", async () => {
43646
+ * const { result } = await trackunitProviders().filterBarValues(yourFilterBarValuesMock).renderHook(() => useYourTestHook());
43647
+ * expect(result.current).toEqual(anything());
43648
+ * });
43649
+ * ...
43650
+ * @returns { TrackunitProvidersMockBuilder } - The builder.
43651
+ */
43652
+ filterBarValues(filterBarValues) {
43653
+ this.selectedFilterBarValues = filterBarValues;
43654
+ return this;
43655
+ }
43630
43656
  /**
43631
43657
  * Use this to pass in a differerent current user subscription.
43632
43658
  * Defaults to mockUserSubscriptionContext.
@@ -43865,10 +43891,10 @@ class TrackunitProvidersMockBuilder {
43865
43891
  * @param addTestRootContainer - if you want to add a root container to the test.
43866
43892
  */
43867
43893
  getMockedCompositionRoot(testChildren, addTestRootContainer = true) {
43868
- return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx("div", { style: {
43869
- "--tw-scale-x": "0.99",
43870
- "--tw-scale-y": "0.99",
43871
- }, className: "w-[1024px] h-[1000px] inline-block", "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
43894
+ return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx("div", { style: {
43895
+ "--tw-scale-x": "0.99",
43896
+ "--tw-scale-y": "0.99",
43897
+ }, className: "w-[1024px] h-[1000px] inline-block", "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) })) }));
43872
43898
  }
43873
43899
  /**
43874
43900
  * This will return the mocked composition root.
package/index.esm2.js CHANGED
@@ -6,7 +6,7 @@ import * as testUtils from 'react-dom/test-utils';
6
6
  import ReactDOM from 'react-dom';
7
7
  import * as ReactDOMClient from 'react-dom/client';
8
8
  import require$$0 from 'util';
9
- import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, GlobalSelectionProvider, AssetSortingProvider } from '@trackunit/react-core-hooks';
9
+ import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, GlobalSelectionProvider, FilterBarProvider, AssetSortingProvider } from '@trackunit/react-core-hooks';
10
10
  import { MemoryRouter } from 'react-router-dom';
11
11
 
12
12
  function _mergeNamespaces(n, m) {
@@ -43514,6 +43514,7 @@ class TrackunitProvidersMockBuilder {
43514
43514
  this.selectedAnalyticsContext = mockAnalyticsContext;
43515
43515
  this.selectedOemBrandingContext = mockOemBrandingContext;
43516
43516
  this.selectedUserSubscriptionContext = mockUserSubscriptionContext;
43517
+ this.selectedFilterBarValues = { filterBarValues: {} };
43517
43518
  }
43518
43519
  /**
43519
43520
  * Use this Analytics Context.
@@ -43599,6 +43600,31 @@ class TrackunitProvidersMockBuilder {
43599
43600
  this.selectedCurrentUserContext = Object.assign(Object.assign({}, mockCurrentUserContext), currentUserContext);
43600
43601
  return this;
43601
43602
  }
43603
+ /**
43604
+ * Use this to pass in a differerent filter bar values when working with pages with filterbar.
43605
+ * Defaults to { filterBarValues: {} }.
43606
+ *
43607
+ * @param filterBarValues - The filter bar values to use.
43608
+ * @example
43609
+ * ...
43610
+ * it("should allow render", async () => {
43611
+ * await trackunitProviders().filterBarValues(yourFilterBarValuesMock).render(<YourTestComponent data-testid="yourTestId" />);
43612
+ * expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
43613
+ * });
43614
+ * ...
43615
+ * @example
43616
+ * ...
43617
+ * it("should allow renderHook", async () => {
43618
+ * const { result } = await trackunitProviders().filterBarValues(yourFilterBarValuesMock).renderHook(() => useYourTestHook());
43619
+ * expect(result.current).toEqual(anything());
43620
+ * });
43621
+ * ...
43622
+ * @returns { TrackunitProvidersMockBuilder } - The builder.
43623
+ */
43624
+ filterBarValues(filterBarValues) {
43625
+ this.selectedFilterBarValues = filterBarValues;
43626
+ return this;
43627
+ }
43602
43628
  /**
43603
43629
  * Use this to pass in a differerent current user subscription.
43604
43630
  * Defaults to mockUserSubscriptionContext.
@@ -43837,10 +43863,10 @@ class TrackunitProvidersMockBuilder {
43837
43863
  * @param addTestRootContainer - if you want to add a root container to the test.
43838
43864
  */
43839
43865
  getMockedCompositionRoot(testChildren, addTestRootContainer = true) {
43840
- return (jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsx(CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsx(AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsx(UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsx(OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsx(TokenProvider, { value: this.selectedTokenContext, children: jsx(ToastProvider, { value: this.selectedToastContext, children: jsx(GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsx("div", { style: {
43841
- "--tw-scale-x": "0.99",
43842
- "--tw-scale-y": "0.99",
43843
- }, className: "w-[1024px] h-[1000px] inline-block", "data-testid": "testRoot", children: testChildren })) : (jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
43866
+ return (jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsx(CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsx(AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsx(UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsx(OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsx(TokenProvider, { value: this.selectedTokenContext, children: jsx(ToastProvider, { value: this.selectedToastContext, children: jsx(GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsx(FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsx("div", { style: {
43867
+ "--tw-scale-x": "0.99",
43868
+ "--tw-scale-y": "0.99",
43869
+ }, className: "w-[1024px] h-[1000px] inline-block", "data-testid": "testRoot", children: testChildren })) : (jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) })) }));
43844
43870
  }
43845
43871
  /**
43846
43872
  * This will return the mocked composition root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts-test",
3
- "version": "0.1.104",
3
+ "version": "0.1.105",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -10,8 +10,8 @@
10
10
  "main": "./index.cjs.js",
11
11
  "dependencies": {
12
12
  "@apollo/client": "3.7.10",
13
- "@trackunit/react-core-contexts-api": "0.2.55",
14
- "@trackunit/react-core-hooks": "0.2.90",
13
+ "@trackunit/react-core-contexts-api": "0.2.56",
14
+ "@trackunit/react-core-hooks": "0.2.91",
15
15
  "graphql": "15.8.0",
16
16
  "lodash": "4.17.21",
17
17
  "react": "18.2.0",
@@ -1,6 +1,6 @@
1
1
  import { MockedResponse } from "@apollo/client/testing";
2
2
  import { RenderResult } from "@testing-library/react";
3
- import { IAnalyticsContext, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, IGlobalSelectionContext, IOemBrandingContext, IToastContext, ITokenContext, IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
3
+ import { FilterBarValues, IAnalyticsContext, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, IGlobalSelectionContext, IOemBrandingContext, IToastContext, ITokenContext, IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
4
4
  import * as React from "react";
5
5
  import { MemoryRouterProps } from "react-router-dom";
6
6
  /**
@@ -24,6 +24,7 @@ export declare class TrackunitProvidersMockBuilder {
24
24
  protected selectedAnalyticsContext: IAnalyticsContext<{}>;
25
25
  protected selectedOemBrandingContext: IOemBrandingContext;
26
26
  protected selectedUserSubscriptionContext: IUserSubscriptionContext;
27
+ protected selectedFilterBarValues: FilterBarValues;
27
28
  /**
28
29
  * Use this Analytics Context.
29
30
  * Defaults to mockAnalyticsContext.
@@ -98,6 +99,28 @@ export declare class TrackunitProvidersMockBuilder {
98
99
  * @returns { TrackunitProvidersMockBuilder } - The builder.
99
100
  */
100
101
  currentUser(currentUserContext: Partial<ICurrentUserContext>): this;
102
+ /**
103
+ * Use this to pass in a differerent filter bar values when working with pages with filterbar.
104
+ * Defaults to { filterBarValues: {} }.
105
+ *
106
+ * @param filterBarValues - The filter bar values to use.
107
+ * @example
108
+ * ...
109
+ * it("should allow render", async () => {
110
+ * await trackunitProviders().filterBarValues(yourFilterBarValuesMock).render(<YourTestComponent data-testid="yourTestId" />);
111
+ * expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
112
+ * });
113
+ * ...
114
+ * @example
115
+ * ...
116
+ * it("should allow renderHook", async () => {
117
+ * const { result } = await trackunitProviders().filterBarValues(yourFilterBarValuesMock).renderHook(() => useYourTestHook());
118
+ * expect(result.current).toEqual(anything());
119
+ * });
120
+ * ...
121
+ * @returns { TrackunitProvidersMockBuilder } - The builder.
122
+ */
123
+ filterBarValues(filterBarValues: FilterBarValues): this;
101
124
  /**
102
125
  * Use this to pass in a differerent current user subscription.
103
126
  * Defaults to mockUserSubscriptionContext.