Skip to content

Commit

Permalink
remove feature flag usage from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benakansara committed Dec 5, 2023
1 parent 562b538 commit 658a30e
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe('renderApp', () => {
const config = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const params = {
const config: Subset<ConfigSchema> = {
unsafe: {
alertDetails: {
logs: { enabled: true },
metrics: { enabled: true },
uptime: { enabled: true },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana/kibana_react
const config = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('APMSection', () => {
const config = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,16 @@ const withCore = makeDecorator({
},
} as unknown as Partial<CoreStart>);

const config: ConfigSchema = {
const config = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
observability: { enabled: false },
},
thresholdRule: { enabled: false },
},
};
} as ConfigSchema;

return (
<MemoryRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import type { TopAlert } from '../typings/alerts';
const defaultConfig = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down Expand Up @@ -63,15 +62,10 @@ describe('isAlertDetailsEnabled', () => {
start: 1630587249674,
lastUpdated: 1630588131750,
} as unknown as TopAlert;
it('returns FALSE when logs: { enabled: false }', () => {
expect(isAlertDetailsEnabledPerApp(logsAlert, defaultConfig)).toBeFalsy();
});

it('returns TRUE when logs: { enabled: true }', () => {
it('returns TRUE when rule type is logs.alert.document.count', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: true },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down Expand Up @@ -113,7 +107,6 @@ describe('isAlertDetailsEnabled', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
},
Expand Down Expand Up @@ -159,7 +152,6 @@ describe('isAlertDetailsEnabled', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: true },
uptime: { enabled: false },
},
Expand Down Expand Up @@ -201,7 +193,6 @@ describe('isAlertDetailsEnabled', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: true },
},
Expand Down Expand Up @@ -243,7 +234,6 @@ describe('isAlertDetailsEnabled', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: true },
metrics: { enabled: true },
uptime: { enabled: true },
},
Expand All @@ -255,7 +245,6 @@ describe('isAlertDetailsEnabled', () => {
const updatedConfig = {
unsafe: {
alertDetails: {
logs: { enabled: true },
metrics: { enabled: true },
uptime: { enabled: true },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ export function KibanaReactStorybookDecorator(Story: ComponentType) {
} as unknown as AppMountParameters;
const observabilityRuleTypeRegistry = createObservabilityRuleTypeRegistryMock();

const config: ConfigSchema = {
const config = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
observability: { enabled: false },
},
thresholdRule: { enabled: false },
},
};
} as ConfigSchema;

const mockTheme: CoreTheme = {
darkMode: false,
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/observability/public/utils/test_helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ const observabilityRuleTypeRegistry = createObservabilityRuleTypeRegistryMock();
export const core = coreMock.createStart();
export const data = dataPluginMock.createStartContract();

const defaultConfig: ConfigSchema = {
const defaultConfig = {
unsafe: {
alertDetails: {
logs: { enabled: false },
metrics: { enabled: false },
uptime: { enabled: false },
observability: { enabled: false },
},
thresholdRule: { enabled: false },
},
};
} as ConfigSchema;

const queryClient = new QueryClient({
defaultOptions: {
Expand Down

0 comments on commit 658a30e

Please sign in to comment.