Skip to content

Commit c7c5910

Browse files
authored
feat(connections): Save connection on successful connection COMPASS-5267 (#2595)
1 parent fa3e64e commit c7c5910

File tree

10 files changed

+314
-149
lines changed

10 files changed

+314
-149
lines changed

package-lock.json

Lines changed: 0 additions & 4 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/react');
1+
module.exports = require('@mongodb-js/mocha-config-compass/compass-plugin');

packages/connections/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@
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",
4443
"test": "mocha",
45-
"posttest": "mongodb-runner stop --port=27018",
46-
"pretest-electron": "mongodb-runner start --port=27018 && node ../../scripts/rebuild.js keytar",
4744
"test-electron": "xvfb-maybe electron-mocha --no-sandbox",
48-
"posttest-electron": "mongodb-runner stop --port=27018",
4945
"test-cov": "nyc -x \"**/*.spec.*\" npm run test",
5046
"test-watch": "npm run test -- --watch",
5147
"test-ci": "npm run test-electron && npm run test-cov",
@@ -83,10 +79,8 @@
8379
"chai": "^4.3.4",
8480
"depcheck": "^1.4.1",
8581
"eslint": "^7.25.0",
86-
"get-port": "^5.1.1",
8782
"mocha": "^8.4.0",
8883
"mongodb-data-service": "^21.13.0",
89-
"mongodb-runner": "^4.8.3",
9084
"nyc": "^15.1.0",
9185
"prettier": "2.3.2",
9286
"rimraf": "^3.0.2",

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

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

66
import Connecting from './connecting';
77

8-
const delay = (amt) => new Promise((resolve) => setTimeout(resolve, amt));
9-
108
describe('Connecting Component', function () {
119
let onCancelConnectionClickedSpy;
1210

1311
beforeEach(function () {
12+
this.clock = sinon.useFakeTimers();
1413
onCancelConnectionClickedSpy = sinon.spy();
1514
});
1615

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

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

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

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

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

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

0 commit comments

Comments
 (0)