Skip to content

Commit

Permalink
Fix EAS CTA condition (#42329)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbattirola authored Jun 5, 2024
1 parent 9f2faaa commit 3c95df4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import React from 'react';
import { MemoryRouter } from 'react-router';
import { render, screen } from 'design/utils/testing';

import { createTeleportContext } from 'teleport/mocks/contexts';
import { createTeleportContext, getAcl } from 'teleport/mocks/contexts';

import { ContextProvider } from 'teleport/index';
import cfg from 'teleport/config';
import { clusters } from 'teleport/Clusters/fixtures';

import { storageService } from 'teleport/services/storageService';

import { getAcl } from 'teleport/mocks/contexts';

import { ExternalAuditStorageCta } from './ExternalAuditStorageCta';

describe('externalAuditStorageCta', () => {
Expand All @@ -51,7 +49,7 @@ describe('externalAuditStorageCta', () => {
});

cfg.isCloud = isCloud;
cfg.externalAuditStorage = lockedFeature;
cfg.externalAuditStorage = !lockedFeature;

jest
.spyOn(storageService, 'getExternalAuditStorageCtaDisabled')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { ButtonLockedFeature } from '../ButtonLockedFeature';
export const ExternalAuditStorageCta = () => {
const [showCta, setShowCta] = useState<boolean>(false);
const ctx = useTeleport();
const featureEnabled = !cfg.externalAuditStorage;
const featureEnabled = cfg.externalAuditStorage;
const userHasAccess = ctx.getFeatureFlags().enrollIntegrationsOrPlugins;

useEffect(() => {
Expand All @@ -49,7 +49,7 @@ export const ExternalAuditStorageCta = () => {
cfg.isCloud &&
!storageService.getExternalAuditStorageCtaDisabled()
);
}, [cfg.isCloud]);
}, [ctx.hasExternalAuditStorage]);

function handleDismiss() {
storageService.disableExternalAuditStorageCta();
Expand Down

0 comments on commit 3c95df4

Please sign in to comment.