-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use package json version for tests (#649)
- Loading branch information
Showing
3 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,9 @@ import { | |
} from './dbTestHelper'; | ||
import type { LoadedConnection } from '../../storage/connectionStorage'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { version } = require('../../../package.json'); | ||
|
||
const testDatabaseConnectionName = 'localhost:27088'; | ||
const testDatabaseURI2WithTimeout = | ||
'mongodb://shouldfail?connectTimeoutMS=1000&serverSelectionTimeoutMS=1000'; | ||
|
@@ -245,8 +248,7 @@ suite('Connection Controller Test Suite', function () { | |
}); | ||
|
||
test('the connection model loads both global and workspace stored connection models', async () => { | ||
const expectedDriverUrl = | ||
'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0'; | ||
const expectedDriverUrl = `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`; | ||
|
||
await vscode.workspace | ||
.getConfiguration('mdb.connectionSaving') | ||
|
@@ -850,7 +852,7 @@ suite('Connection Controller Test Suite', function () { | |
); | ||
assert.strictEqual( | ||
connections[0].connectionOptions?.connectionString.includes( | ||
'appname=mongodb-vscode+0.0.0-dev.0' | ||
`appname=mongodb-vscode+${version}` | ||
), | ||
true | ||
); | ||
|
@@ -894,8 +896,7 @@ suite('Connection Controller Test Suite', function () { | |
assert.deepStrictEqual(connectionInfo, { | ||
id: 'c4871b21-92c4-40e2-a2c2-fdd551cff114', | ||
connectionOptions: { | ||
connectionString: | ||
'mongodb+srv://username:[email protected]/?authSource=admin&readPreference=primary&appname=mongodb-vscode+0.0.0-dev.0&ssl=true', | ||
connectionString: `mongodb+srv://username:[email protected]/?authSource=admin&readPreference=primary&appname=mongodb-vscode+${version}&ssl=true`, | ||
}, | ||
}); | ||
}); | ||
|
@@ -914,7 +915,7 @@ suite('Connection Controller Test Suite', function () { | |
delete mongoClientConnectionOptions.options.oidc?.openBrowser; | ||
|
||
assert.deepStrictEqual(mongoClientConnectionOptions, { | ||
url: 'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0', | ||
url: `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`, | ||
options: { | ||
autoEncryption: undefined, | ||
monitorCommands: true, | ||
|
@@ -929,11 +930,10 @@ suite('Connection Controller Test Suite', function () { | |
}); | ||
|
||
test('_getConnectionStringWithProxy returns string with proxy options', () => { | ||
const expectedConnectionStringWithProxy = | ||
'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0&proxyHost=localhost&proxyPassword=gwce7tr8733ujbr&proxyPort=3378&proxyUsername=test'; | ||
const expectedConnectionStringWithProxy = `mongodb://localhost:27088/?appname=mongodb-vscode+${version}&proxyHost=localhost&proxyPassword=gwce7tr8733ujbr&proxyPort=3378&proxyUsername=test`; | ||
const connectionString = | ||
testConnectionController._getConnectionStringWithProxy({ | ||
url: 'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0', | ||
url: `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`, | ||
options: { | ||
proxyHost: 'localhost', | ||
proxyPassword: 'gwce7tr8733ujbr', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters