Skip to content

Commit d009957

Browse files
committed
fix: prettier formatting and add coverage/ to .prettierignore
Co-authored-by: samikshya-chand_data
1 parent e81ad15 commit d009957

6 files changed

Lines changed: 13 additions & 37 deletions

File tree

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules
55
.nyc_output
66
coverage_e2e
77
coverage_unit
8+
coverage
89
.clinic
910

1011
dist

lib/telemetry/TelemetryClient.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ import { LogLevel } from '../contracts/IDBSQLLogger';
2525
class TelemetryClient {
2626
private closed: boolean = false;
2727

28-
constructor(
29-
private context: IClientContext,
30-
private host: string
31-
) {
28+
constructor(private context: IClientContext, private host: string) {
3229
const logger = context.getLogger();
3330
logger.log(LogLevel.debug, `Created TelemetryClient for host: ${host}`);
3431
}

lib/telemetry/TelemetryClientProvider.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ class TelemetryClientProvider {
6868

6969
// Increment reference count
7070
holder.refCount += 1;
71-
logger.log(
72-
LogLevel.debug,
73-
`TelemetryClient reference count for ${host}: ${holder.refCount}`
74-
);
71+
logger.log(LogLevel.debug, `TelemetryClient reference count for ${host}: ${holder.refCount}`);
7572

7673
return holder.client;
7774
}
@@ -93,10 +90,7 @@ class TelemetryClientProvider {
9390

9491
// Decrement reference count
9592
holder.refCount -= 1;
96-
logger.log(
97-
LogLevel.debug,
98-
`TelemetryClient reference count for ${host}: ${holder.refCount}`
99-
);
93+
logger.log(LogLevel.debug, `TelemetryClient reference count for ${host}: ${holder.refCount}`);
10094

10195
// Close and remove client when reference count reaches zero
10296
if (holder.refCount <= 0) {

tests/unit/.stubs/ClientContextStub.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ export default class ClientContextStub implements IClientContext {
4848
public async getDriver(): Promise<IDriver> {
4949
return this.driver;
5050
}
51-
5251
}

tests/unit/telemetry/TelemetryClient.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ describe('TelemetryClient', () => {
3838

3939
new TelemetryClient(context, HOST);
4040

41-
expect(logSpy.calledWith(LogLevel.debug, `Created TelemetryClient for host: ${HOST}`)).to.be
42-
.true;
41+
expect(logSpy.calledWith(LogLevel.debug, `Created TelemetryClient for host: ${HOST}`)).to.be.true;
4342
});
4443
});
4544

@@ -87,8 +86,7 @@ describe('TelemetryClient', () => {
8786

8887
await client.close();
8988

90-
expect(logSpy.calledWith(LogLevel.debug, `Closing TelemetryClient for host: ${HOST}`)).to.be
91-
.true;
89+
expect(logSpy.calledWith(LogLevel.debug, `Closing TelemetryClient for host: ${HOST}`)).to.be.true;
9290
});
9391

9492
it('should be idempotent', async () => {

tests/unit/telemetry/TelemetryClientProvider.test.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ describe('TelemetryClientProvider', () => {
9191

9292
provider.getOrCreateClient(HOST1);
9393

94-
expect(
95-
logSpy.calledWith(LogLevel.debug, `Created new TelemetryClient for host: ${HOST1}`)
96-
).to.be.true;
94+
expect(logSpy.calledWith(LogLevel.debug, `Created new TelemetryClient for host: ${HOST1}`)).to.be.true;
9795
});
9896

9997
it('should log reference count at debug level', () => {
@@ -103,9 +101,7 @@ describe('TelemetryClientProvider', () => {
103101

104102
provider.getOrCreateClient(HOST1);
105103

106-
expect(
107-
logSpy.calledWith(LogLevel.debug, `TelemetryClient reference count for ${HOST1}: 1`)
108-
).to.be.true;
104+
expect(logSpy.calledWith(LogLevel.debug, `TelemetryClient reference count for ${HOST1}: 1`)).to.be.true;
109105
});
110106

111107
it('should pass context to TelemetryClient', () => {
@@ -184,8 +180,7 @@ describe('TelemetryClientProvider', () => {
184180

185181
await provider.releaseClient(HOST1);
186182

187-
expect(logSpy.calledWith(LogLevel.debug, `No TelemetryClient found for host: ${HOST1}`)).to
188-
.be.true;
183+
expect(logSpy.calledWith(LogLevel.debug, `No TelemetryClient found for host: ${HOST1}`)).to.be.true;
189184
});
190185

191186
it('should log reference count decrease at debug level', async () => {
@@ -198,9 +193,7 @@ describe('TelemetryClientProvider', () => {
198193

199194
await provider.releaseClient(HOST1);
200195

201-
expect(
202-
logSpy.calledWith(LogLevel.debug, `TelemetryClient reference count for ${HOST1}: 1`)
203-
).to.be.true;
196+
expect(logSpy.calledWith(LogLevel.debug, `TelemetryClient reference count for ${HOST1}: 1`)).to.be.true;
204197
});
205198

206199
it('should log client closure at debug level', async () => {
@@ -211,9 +204,7 @@ describe('TelemetryClientProvider', () => {
211204
provider.getOrCreateClient(HOST1);
212205
await provider.releaseClient(HOST1);
213206

214-
expect(
215-
logSpy.calledWith(LogLevel.debug, `Closed and removed TelemetryClient for host: ${HOST1}`)
216-
).to.be.true;
207+
expect(logSpy.calledWith(LogLevel.debug, `Closed and removed TelemetryClient for host: ${HOST1}`)).to.be.true;
217208
});
218209

219210
it('should swallow errors during client closure', async () => {
@@ -227,9 +218,7 @@ describe('TelemetryClientProvider', () => {
227218

228219
await provider.releaseClient(HOST1);
229220

230-
expect(
231-
logSpy.calledWith(LogLevel.debug, `Error releasing TelemetryClient: ${error.message}`)
232-
).to.be.true;
221+
expect(logSpy.calledWith(LogLevel.debug, `Error releasing TelemetryClient: ${error.message}`)).to.be.true;
233222
});
234223
});
235224

@@ -388,9 +377,7 @@ describe('TelemetryClientProvider', () => {
388377

389378
await provider.releaseClient(HOST1);
390379

391-
const errorLogs = logSpy
392-
.getCalls()
393-
.filter((call) => call.args[1].includes('Error releasing'));
380+
const errorLogs = logSpy.getCalls().filter((call) => call.args[1].includes('Error releasing'));
394381
expect(errorLogs.length).to.be.greaterThan(0);
395382
errorLogs.forEach((call) => {
396383
expect(call.args[0]).to.equal(LogLevel.debug);

0 commit comments

Comments
 (0)