Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

fix: stop test assets bundled in production #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions client/Contexts/ConfigFeatureFlag/ConfigFeatureFlag.assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
* Copyright Strimzi authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
// deliberately not using the barrel as causes a circular dependency
import {
generateMockDataResponseForGQLRequest,
generateMockErrorResponseForGQLRequest,
} from 'utils/test/withApollo/withApollo.util';
import {
ConfigFeatureFlagType,
ApolloQueryResponseType,
} from './ConfigFeatureFlag.types';
import { GET_CONFIG } from 'Queries/Config';

export const defaultClientConfig: ApolloQueryResponseType = {
client: {},
Expand All @@ -33,59 +27,3 @@ export const defaultConfigFeatureFlagValue: ConfigFeatureFlagType = {
// NO-OP - placeholder
},
};

const mockClientResponse = {
about: {
version: '1.2.3',
},
};
const mockFeatureFlagResponse = {
client: {
Home: {
showVersion: true,
},
Pages: {
PlaceholderHome: true,
},
},
};

const mockError = new Error('Example error case');

export const mockData = {
mockClientResponse,
mockFeatureFlagResponse,
mockError,
};

const additionalRequestArgs = {
variables: {},
context: {
purpose: 'config',
},
};

const noOpRequest = generateMockDataResponseForGQLRequest(
GET_CONFIG,
{},
additionalRequestArgs
);
const successRequest = generateMockDataResponseForGQLRequest(
GET_CONFIG,
{
client: mockClientResponse,
featureFlags: mockFeatureFlagResponse,
},
additionalRequestArgs
);
const errorRequest = generateMockErrorResponseForGQLRequest(
GET_CONFIG,
mockError,
additionalRequestArgs
);

export const mockRequests = {
noOpRequest,
successRequest,
errorRequest,
};
3 changes: 1 addition & 2 deletions client/Contexts/ConfigFeatureFlag/ConfigFeatureFlag.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import {
ConfigFeatureFlagProvider,
ConfigFeatureFlagConsumer,
} from './Context';
import { mockData, mockRequests } from './ConfigFeatureFlag.testassets';
import {
defaultClientConfig,
defaultConfigFeatureFlagValue,
mockData,
mockRequests,
} from './ConfigFeatureFlag.assets';

import { ConfigFeatureFlagType } from './ConfigFeatureFlag.types';
Expand Down
66 changes: 66 additions & 0 deletions client/Contexts/ConfigFeatureFlag/ConfigFeatureFlag.testassets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright Strimzi authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
// deliberately not using the barrel as causes a circular dependency
import {
generateMockDataResponseForGQLRequest,
generateMockErrorResponseForGQLRequest,
} from 'utils/test/withApollo/withApollo.util';
import { GET_CONFIG } from 'Queries/Config';

const mockClientResponse = {
about: {
version: '1.2.3',
},
};
const mockFeatureFlagResponse = {
client: {
Home: {
showVersion: true,
},
Pages: {
PlaceholderHome: true,
},
},
};

const mockError = new Error('Example error case');

export const mockData = {
mockClientResponse,
mockFeatureFlagResponse,
mockError,
};

const additionalRequestArgs = {
variables: {},
context: {
purpose: 'config',
},
};

const noOpRequest = generateMockDataResponseForGQLRequest(
GET_CONFIG,
{},
additionalRequestArgs
);
const successRequest = generateMockDataResponseForGQLRequest(
GET_CONFIG,
{
client: mockClientResponse,
featureFlags: mockFeatureFlagResponse,
},
additionalRequestArgs
);
const errorRequest = generateMockErrorResponseForGQLRequest(
GET_CONFIG,
mockError,
additionalRequestArgs
);

export const mockRequests = {
noOpRequest,
successRequest,
errorRequest,
};