Skip to content

Commit b5f656d

Browse files
authored
Revert "feat(connections): Save connection on successful connection COMPASS-5267 (#2595)" (#2608)
This reverts commit c7c5910.
1 parent 09ced06 commit b5f656d

File tree

10 files changed

+149
-314
lines changed

10 files changed

+149
-314
lines changed

package-lock.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/connections/.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('@mongodb-js/mocha-config-compass/compass-plugin');
1+
module.exports = require('@mongodb-js/mocha-config-compass/react');

packages/connections/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@
4040
"depcheck": "depcheck",
4141
"check": "npm run lint && npm run depcheck",
4242
"check-ci": "npm run check",
43+
"pretest": "mongodb-runner start --port=27018 && node ../../scripts/rebuild.js keytar",
4344
"test": "mocha",
45+
"posttest": "mongodb-runner stop --port=27018",
46+
"pretest-electron": "mongodb-runner start --port=27018 && node ../../scripts/rebuild.js keytar",
4447
"test-electron": "xvfb-maybe electron-mocha --no-sandbox",
48+
"posttest-electron": "mongodb-runner stop --port=27018",
4549
"test-cov": "nyc -x \"**/*.spec.*\" npm run test",
4650
"test-watch": "npm run test -- --watch",
4751
"test-ci": "npm run test-electron && npm run test-cov",
@@ -79,8 +83,10 @@
7983
"chai": "^4.3.4",
8084
"depcheck": "^1.4.1",
8185
"eslint": "^7.25.0",
86+
"get-port": "^5.1.1",
8287
"mocha": "^8.4.0",
8388
"mongodb-data-service": "^21.13.0",
89+
"mongodb-runner": "^4.8.3",
8490
"nyc": "^15.1.0",
8591
"prettier": "2.3.2",
8692
"rimraf": "^3.0.2",

packages/connections/src/components/connecting/connecting.spec.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import sinon from 'sinon';
55

66
import Connecting from './connecting';
77

8+
const delay = (amt) => new Promise((resolve) => setTimeout(resolve, amt));
9+
810
describe('Connecting Component', function () {
911
let onCancelConnectionClickedSpy;
1012

1113
beforeEach(function () {
12-
this.clock = sinon.useFakeTimers();
1314
onCancelConnectionClickedSpy = sinon.spy();
1415
});
1516

@@ -19,7 +20,6 @@ describe('Connecting Component', function () {
1920
});
2021

2122
afterEach(function () {
22-
this.clock.restore();
2323
// Modals can have delays and transitions so it's best to cleanup.
2424
cleanup();
2525
});
@@ -47,9 +47,8 @@ describe('Connecting Component', function () {
4747
});
4848

4949
describe('after a slight delay', function () {
50-
beforeEach(function () {
51-
// Speedup the modal showing annimation.
52-
this.clock.tick(300);
50+
beforeEach(async function () {
51+
await delay(300);
5352
});
5453

5554
it('shows the connecting modal', function () {

packages/connections/src/components/connecting/connecting.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function Connecting({
7575
<ConnectingAnimation />
7676
<Link
7777
as="button"
78+
data-testid="cancel-connection-attempt-button"
7879
onClick={onCancelConnectionClicked}
7980
hideExternalIcon
8081
className={cancelButtonStyles}

0 commit comments

Comments
 (0)