Skip to content

Commit 4137aa3

Browse files
committed
Merge remote-tracking branch 'origin/main' into 1.30-releases
2 parents 6a6a7e7 + b9c805b commit 4137aa3

File tree

10 files changed

+633
-15
lines changed

10 files changed

+633
-15
lines changed

.evergreen.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ functions:
320320
params:
321321
local_file: src/packages/compass/dist/${windows_setup_filename}
322322
remote_file: ${project}/${revision}/${windows_setup_filename}
323+
- <<: *save-artifact
324+
params:
325+
local_file: src/packages/compass/dist/${windows_msi_filename}
326+
remote_file: ${project}/${revision}/${windows_msi_filename}
323327
- <<: *save-artifact
324328
params:
325329
local_file: src/packages/compass/dist/${windows_zip_filename}
@@ -331,8 +335,8 @@ functions:
331335
remote_file: ${project}/${revision}/${windows_nupkg_full_filename}
332336
- <<: *save-artifact
333337
params:
334-
local_file: src/packages/compass/dist/${compass_distribution}-RELEASES
335-
remote_file: ${project}/${revision}/${compass_distribution}-RELEASES
338+
local_file: src/packages/compass/dist/${windows_releases_filename}
339+
remote_file: ${project}/${revision}/${windows_releases_filename}
336340

337341
save-macos-artifacts:
338342
- <<: *save-artifact
@@ -375,6 +379,10 @@ functions:
375379
params:
376380
local_file: src/packages/compass/dist/${windows_setup_filename}
377381
remote_file: ${project}/${revision}/${windows_setup_filename}
382+
- <<: *get-artifact
383+
params:
384+
local_file: src/packages/compass/dist/${windows_msi_filename}
385+
remote_file: ${project}/${revision}/${windows_msi_filename}
378386
- <<: *get-artifact
379387
params:
380388
local_file: src/packages/compass/dist/${windows_zip_filename}
@@ -385,8 +393,8 @@ functions:
385393
remote_file: ${project}/${revision}/${windows_nupkg_full_filename}
386394
- <<: *get-artifact
387395
params:
388-
local_file: src/packages/compass/dist/${compass_distribution}-RELEASES
389-
remote_file: ${project}/${revision}/${compass_distribution}-RELEASES
396+
local_file: src/packages/compass/dist/${windows_releases_filename}
397+
remote_file: ${project}/${revision}/${windows_releases_filename}
390398

391399
- <<: *get-artifact
392400
params:

packages/connect-form/src/components/advanced-options-tabs/advanced-options-tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ConnectionStringUrl from 'mongodb-connection-string-url';
55

66
import GeneralTab from './general-tab';
77
import AuthenticationTab from './authentication-tab';
8-
import SSLTab from './ssl-tab';
8+
import TLSTab from './tls-ssl-tab/tls-ssl-tab';
99
import SSHTunnelTab from './ssh-tunnel-tab';
1010
import AdvancedTab from './advanced-tab';
1111
import { UpdateConnectionFormField } from '../../hooks/use-connect-form';
@@ -40,7 +40,7 @@ function AdvancedOptionsTabs({
4040
const tabs: TabObject[] = [
4141
{ name: 'General', component: GeneralTab },
4242
{ name: 'Authentication', component: AuthenticationTab },
43-
{ name: 'TLS/SSL', component: SSLTab },
43+
{ name: 'TLS/SSL', component: TLSTab },
4444
{ name: 'SSH Tunnel', component: SSHTunnelTab },
4545
{ name: 'Advanced', component: AdvancedTab },
4646
];

packages/connect-form/src/components/advanced-options-tabs/ssl-tab.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
import React from 'react';
2+
import { render, screen, fireEvent } from '@testing-library/react';
3+
import { expect } from 'chai';
4+
import sinon from 'sinon';
5+
import ConnectionStringUrl from 'mongodb-connection-string-url';
6+
7+
import SSLTab, { getTLSOptionForConnectionString } from './tls-ssl-tab';
8+
9+
describe('SchemaInput', function () {
10+
let updateConnectionFormFieldSpy: sinon.SinonSpy;
11+
12+
beforeEach(function () {
13+
updateConnectionFormFieldSpy = sinon.spy();
14+
});
15+
16+
describe('with ssl=true', function () {
17+
beforeEach(function () {
18+
const connectionStringUrl = new ConnectionStringUrl(
19+
'mongodb+srv://0ranges:p!neapp1es@localhost/?ssl=true'
20+
);
21+
render(
22+
<SSLTab
23+
connectionStringUrl={connectionStringUrl}
24+
updateConnectionFormField={updateConnectionFormFieldSpy}
25+
/>
26+
);
27+
});
28+
29+
it('should render the TLS/SSL `On` radio box selected', function () {
30+
const tlsOnRadioBox = screen.getAllByRole('radio')[1] as HTMLInputElement;
31+
expect(tlsOnRadioBox.checked).to.equal(true);
32+
expect(tlsOnRadioBox.getAttribute('aria-checked')).to.equal('true');
33+
});
34+
35+
it('should render TLS/SSL `Default` and `Off` radio boxes not selected', function () {
36+
const tlsDefaultRadioBox = screen.getAllByRole(
37+
'radio'
38+
)[0] as HTMLInputElement;
39+
expect(tlsDefaultRadioBox.checked).to.equal(false);
40+
expect(tlsDefaultRadioBox.getAttribute('aria-checked')).to.equal('false');
41+
42+
const tlsOffRadioBox = screen.getAllByRole(
43+
'radio'
44+
)[2] as HTMLInputElement;
45+
expect(tlsOffRadioBox.checked).to.equal(false);
46+
expect(tlsOffRadioBox.getAttribute('aria-checked')).to.equal('false');
47+
});
48+
49+
describe('when TLS/SSL default is clicked', function () {
50+
beforeEach(function () {
51+
const tlsDefaultRadioBox = screen.getAllByRole('radio')[0];
52+
fireEvent.click(tlsDefaultRadioBox);
53+
});
54+
55+
it('should call to update the connection configuration to TLS/SSL default', function () {
56+
expect(updateConnectionFormFieldSpy.callCount).to.equal(1);
57+
expect(updateConnectionFormFieldSpy.firstCall.args[0]).to.deep.equal({
58+
type: 'update-tls-option',
59+
tlsOption: 'DEFAULT',
60+
});
61+
});
62+
});
63+
64+
describe('when TLS/SSL off is clicked', function () {
65+
beforeEach(function () {
66+
const standardSchemaRadioBox = screen.getAllByRole('radio')[2];
67+
fireEvent.click(standardSchemaRadioBox);
68+
});
69+
70+
it('should call to update the connection configuration to TLS/SSL off', function () {
71+
expect(updateConnectionFormFieldSpy.callCount).to.equal(1);
72+
expect(updateConnectionFormFieldSpy.firstCall.args[0]).to.deep.equal({
73+
type: 'update-tls-option',
74+
tlsOption: 'OFF',
75+
});
76+
});
77+
});
78+
79+
describe('when TLS/SSL on is clicked', function () {
80+
beforeEach(function () {
81+
const standardSchemaRadioBox = screen.getAllByRole('radio')[1];
82+
fireEvent.click(standardSchemaRadioBox);
83+
});
84+
85+
it("shouldn't call to update anything", function () {
86+
expect(updateConnectionFormFieldSpy.callCount).to.equal(0);
87+
});
88+
});
89+
});
90+
91+
describe('with ssl=false', function () {
92+
beforeEach(function () {
93+
const connectionStringUrl = new ConnectionStringUrl(
94+
'mongodb+srv://0ranges:p!neapp1es@localhost/?ssl=false'
95+
);
96+
render(
97+
<SSLTab
98+
connectionStringUrl={connectionStringUrl}
99+
updateConnectionFormField={updateConnectionFormFieldSpy}
100+
/>
101+
);
102+
});
103+
104+
it('should render the TLS/SSL `Off` radio box selected', function () {
105+
const tlsOnRadioBox = screen.getAllByRole('radio')[2] as HTMLInputElement;
106+
expect(tlsOnRadioBox.checked).to.equal(true);
107+
expect(tlsOnRadioBox.getAttribute('aria-checked')).to.equal('true');
108+
});
109+
110+
describe('when TLS/SSL off is clicked', function () {
111+
beforeEach(function () {
112+
const standardSchemaRadioBox = screen.getAllByRole('radio')[2];
113+
fireEvent.click(standardSchemaRadioBox);
114+
});
115+
116+
it("shouldn't call to update anything", function () {
117+
expect(updateConnectionFormFieldSpy.callCount).to.equal(0);
118+
});
119+
});
120+
121+
describe('when TLS/SSL on is clicked', function () {
122+
beforeEach(function () {
123+
const standardSchemaRadioBox = screen.getAllByRole('radio')[1];
124+
fireEvent.click(standardSchemaRadioBox);
125+
});
126+
127+
it('should call to update the connection configuration to TLS/SSL on', function () {
128+
expect(updateConnectionFormFieldSpy.callCount).to.equal(1);
129+
expect(updateConnectionFormFieldSpy.firstCall.args[0]).to.deep.equal({
130+
type: 'update-tls-option',
131+
tlsOption: 'ON',
132+
});
133+
});
134+
});
135+
});
136+
137+
describe('#getTLSOptionForConnectionString', function () {
138+
let testUrl: ConnectionStringUrl;
139+
140+
beforeEach(function () {
141+
testUrl = new ConnectionStringUrl('mongodb://localhost');
142+
});
143+
144+
it('should return `DEFAULT` when tls and ssl are unset', function () {
145+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('DEFAULT');
146+
});
147+
148+
describe('when tls is `true`', function () {
149+
beforeEach(function () {
150+
testUrl.searchParams.set('tls', 'true');
151+
});
152+
153+
it('should return `ON`', function () {
154+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('ON');
155+
});
156+
157+
describe('when ssl is `false`', function () {
158+
beforeEach(function () {
159+
testUrl.searchParams.set('ssl', 'false');
160+
});
161+
162+
it('should return `undefined`', function () {
163+
expect(getTLSOptionForConnectionString(testUrl)).to.equal(undefined);
164+
});
165+
});
166+
});
167+
168+
describe('when ssl is `true`', function () {
169+
beforeEach(function () {
170+
testUrl.searchParams.set('ssl', 'true');
171+
});
172+
173+
it('should return `ON`', function () {
174+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('ON');
175+
});
176+
177+
describe('when tls is `false`', function () {
178+
beforeEach(function () {
179+
testUrl.searchParams.set('tls', 'false');
180+
});
181+
182+
it('should return `undefined`', function () {
183+
expect(getTLSOptionForConnectionString(testUrl)).to.equal(undefined);
184+
});
185+
});
186+
187+
describe('when tls is `true`', function () {
188+
beforeEach(function () {
189+
testUrl.searchParams.set('tls', 'true');
190+
});
191+
192+
it('should return `ON`', function () {
193+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('ON');
194+
});
195+
});
196+
});
197+
198+
describe('when ssl is `false`', function () {
199+
beforeEach(function () {
200+
testUrl.searchParams.set('ssl', 'false');
201+
});
202+
203+
it('should return `OFF`', function () {
204+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('OFF');
205+
});
206+
207+
describe('when tls is `true`', function () {
208+
beforeEach(function () {
209+
testUrl.searchParams.set('tls', 'true');
210+
});
211+
212+
it('should return `undefined`', function () {
213+
expect(getTLSOptionForConnectionString(testUrl)).to.equal(undefined);
214+
});
215+
});
216+
});
217+
218+
describe('when tls is `false`', function () {
219+
beforeEach(function () {
220+
testUrl.searchParams.set('tls', 'false');
221+
});
222+
223+
it('should return `ON`', function () {
224+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('OFF');
225+
});
226+
227+
describe('when ssl `false`', function () {
228+
beforeEach(function () {
229+
testUrl.searchParams.set('ssl', 'false');
230+
});
231+
232+
it('should return `OFF`', function () {
233+
expect(getTLSOptionForConnectionString(testUrl)).to.equal('OFF');
234+
});
235+
});
236+
});
237+
238+
describe('when tls has a value not `true` or `false`', function () {
239+
beforeEach(function () {
240+
testUrl.searchParams.set('ssl', 'aaaa');
241+
});
242+
243+
it('should return `undefined`', function () {
244+
expect(getTLSOptionForConnectionString(testUrl)).to.equal(undefined);
245+
});
246+
});
247+
248+
describe('when ssl has a value not `true` or `false`', function () {
249+
beforeEach(function () {
250+
testUrl.searchParams.set('ssl', 'aaaa');
251+
});
252+
253+
it('should return `undefined`', function () {
254+
expect(getTLSOptionForConnectionString(testUrl)).to.equal(undefined);
255+
});
256+
});
257+
});
258+
});

0 commit comments

Comments
 (0)