Skip to content

Commit 48a7ec5

Browse files
committed
chore: fix formatting of all testing folder files
1 parent 66f996e commit 48a7ec5

File tree

6 files changed

+31
-23
lines changed

6 files changed

+31
-23
lines changed

testing/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ module.exports = {
55
extends: ["@mongodb-js/eslint-config-mongosh"],
66
parserOptions: {
77
tsconfigRootDir: fixCygwinPath(__dirname),
8-
project: ["./tsconfig-lint.json"],
8+
project: ["./tsconfig.json"],
99
},
1010
};

testing/disable-dns-srv.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
'use strict';
2-
const dns = require('dns');
3-
console.log('!!! Disabling SRV and TXT DNS queries through the Node.js API !!!');
1+
"use strict";
2+
const dns = require("dns");
3+
// eslint-disable-next-line no-console
4+
console.log(
5+
"!!! Disabling SRV and TXT DNS queries through the Node.js API !!!"
6+
);
47

58
const origResolve = dns.resolve;
69
const origPromiseResolve = dns.promises.resolve;
7-
const err = Object.assign(new Error('SRV and TXT not available'), { code: 'ENODATA' });
10+
const err = Object.assign(new Error("SRV and TXT not available"), {
11+
code: "ENODATA",
12+
});
813

914
dns.resolve = (hostname, type, cb) => {
10-
if (type === 'SRV' || type === 'TXT')
11-
return process.nextTick(cb, err);
15+
if (type === "SRV" || type === "TXT") return process.nextTick(cb, err);
1216
return origResolve(hostname, type, cb);
1317
};
1418
dns.resolveSrv = (hostname, cb) => {
@@ -17,9 +21,8 @@ dns.resolveSrv = (hostname, cb) => {
1721
dns.resolveTxt = (hostname, cb) => {
1822
return process.nextTick(cb, err);
1923
};
20-
dns.promises.resolve = async(hostname, type) => {
21-
if (type === 'SRV' || type === 'TXT')
22-
throw err;
24+
dns.promises.resolve = async (hostname, type) => {
25+
if (type === "SRV" || type === "TXT") throw err;
2326
await origPromiseResolve;
2427
};
2528
dns.promises.resolveSrv = () => Promise.reject(err);

testing/eventually.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
export async function eventually(fn: Function, opts: { initialInterval?: number; timeout?: number, backoffFactor?: number } = {}): Promise<any> {
1+
export async function eventually(
2+
fn: Function,
3+
opts: {
4+
initialInterval?: number;
5+
timeout?: number;
6+
backoffFactor?: number;
7+
} = {}
8+
): Promise<any> {
29
const options = {
310
initialInterval: 100,
411
timeout: 10000,
512
backoffFactor: 1, // no backoff
6-
...opts
13+
...opts,
714
};
815

916
let attempts = calculateAttempts(options);
@@ -21,20 +28,24 @@ export async function eventually(fn: Function, opts: { initialInterval?: number;
2128
err = e;
2229
}
2330

24-
await new Promise(resolve => setTimeout(resolve, currentInterval));
31+
await new Promise((resolve) => setTimeout(resolve, currentInterval));
2532

2633
currentInterval *= options.backoffFactor;
2734
}
2835

2936
Object.assign(err, {
3037
timedOut: true,
3138
timeout: options.timeout,
32-
message: `[Timed out ${options.timeout}ms] ${err.message}`
39+
message: `[Timed out ${options.timeout}ms] ${err.message}`,
3340
});
3441
throw err;
3542
}
3643

37-
function calculateAttempts(options: { initialInterval: number; timeout: number; backoffFactor: number; }): number {
44+
function calculateAttempts(options: {
45+
initialInterval: number;
46+
timeout: number;
47+
backoffFactor: number;
48+
}): number {
3849
let totalInterval = 0;
3950
let attempts = 0;
4051
let interval = options.initialInterval;
@@ -46,4 +57,3 @@ function calculateAttempts(options: { initialInterval: number; timeout: number;
4657
}
4758
return attempts;
4859
}
49-

testing/fake-kms.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export const fakeAWSHandlers: HandlerList = [
6666

6767
function awsHandler({ body }: RequestData): any {
6868
const request = JSON.parse(body);
69-
let response;
7069
if (request.KeyId && request.Plaintext) {
7170
// Famously "unbreakable" base64 encryption ;) We use this to forward
7271
// both KeyId and Plaintext so that they are available for generating

testing/tsconfig-lint.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

testing/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json",
3-
"include": ["**/*", "../packages/e2e-tests/test/integration-testing-hooks.ts"]
3+
"include": ["**/*"],
4+
"exclude": ["certificates"]
45
}

0 commit comments

Comments
 (0)