Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webview): update feature flag to always show new connection form VSCODE-490 #637

Merged
merged 1 commit into from
Jan 2, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const FEATURE_FLAGS = {
useNewConnectionForm: `${process.env.MDB_USE_NEW_CONNECTION_FORM}` === 'true',
useOldConnectionForm: `${process.env.MDB_USE_OLD_CONNECTION_FORM}` === 'true',
};

export type FeatureFlag = keyof typeof FEATURE_FLAGS;
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/views/webview-app/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import App from '../../../../views/webview-app/app';

describe('App Component Test Suite', () => {
afterEach(() => sinon.restore());
test('it renders the old overview page when useNewConnectionForm is falsy', () => {
test('it renders the old overview page when useOldConnectionForm is falsy', () => {
sinon.stub(featureFlags, 'getFeatureFlag').returns(false);
render(<App />);
expect(() => screen.getAllByTestId('legacy-app')).does.not.throw;
expect(screen.queryByTestId('legacy-app')).to.be.null;
});

test('it renders the new overview page when useNewConnectionForm is truthy', () => {
test('it renders the new overview page when useOldConnectionForm is truthy', () => {
sinon.stub(featureFlags, 'getFeatureFlag').returns(true);
render(<App />);
expect(screen.queryByTestId('legacy-app')).to.be.null;
expect(() => screen.getAllByTestId('legacy-app')).does.not.throw;
});
});
6 changes: 3 additions & 3 deletions src/views/webview-app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { useDetectVsCodeDarkMode } from './use-detect-vscode-dark-mode';
const App: React.FC = () => {
const darkMode = useDetectVsCodeDarkMode();

return getFeatureFlag('useNewConnectionForm') ? (
return getFeatureFlag('useOldConnectionForm') ? (
<LegacyApp />
) : (
<LeafyGreenProvider darkMode={darkMode}>
<OverviewPage />
</LeafyGreenProvider>
) : (
<LegacyApp />
);
};

Expand Down
Loading