Skip to content

Commit dc4c97f

Browse files
committed
fix an issue with prettier
1 parent e4e8ec5 commit dc4c97f

File tree

1 file changed

+112
-16
lines changed

1 file changed

+112
-16
lines changed

packages/sdk/server-ai/__tests__/LDAIConfigTrackerImpl.test.ts

Lines changed: 112 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ beforeEach(() => {
2121
});
2222

2323
it('tracks duration', () => {
24-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
24+
const tracker = new LDAIConfigTrackerImpl(
25+
mockLdClient,
26+
configKey,
27+
variationKey,
28+
version,
29+
testContext,
30+
);
2531
tracker.trackDuration(1000);
2632

2733
expect(mockTrack).toHaveBeenCalledWith(
@@ -33,7 +39,13 @@ it('tracks duration', () => {
3339
});
3440

3541
it('tracks duration of async function', async () => {
36-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
42+
const tracker = new LDAIConfigTrackerImpl(
43+
mockLdClient,
44+
configKey,
45+
variationKey,
46+
version,
47+
testContext,
48+
);
3749
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
3850

3951
const result = await tracker.trackDurationOf(async () => 'test-result');
@@ -48,7 +60,13 @@ it('tracks duration of async function', async () => {
4860
});
4961

5062
it('tracks time to first token', () => {
51-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
63+
const tracker = new LDAIConfigTrackerImpl(
64+
mockLdClient,
65+
configKey,
66+
variationKey,
67+
version,
68+
testContext,
69+
);
5270
tracker.trackTimeToFirstToken(1000);
5371

5472
expect(mockTrack).toHaveBeenCalledWith(
@@ -60,7 +78,13 @@ it('tracks time to first token', () => {
6078
});
6179

6280
it('tracks positive feedback', () => {
63-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
81+
const tracker = new LDAIConfigTrackerImpl(
82+
mockLdClient,
83+
configKey,
84+
variationKey,
85+
version,
86+
testContext,
87+
);
6488
tracker.trackFeedback({ kind: LDFeedbackKind.Positive });
6589

6690
expect(mockTrack).toHaveBeenCalledWith(
@@ -72,7 +96,13 @@ it('tracks positive feedback', () => {
7296
});
7397

7498
it('tracks negative feedback', () => {
75-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
99+
const tracker = new LDAIConfigTrackerImpl(
100+
mockLdClient,
101+
configKey,
102+
variationKey,
103+
version,
104+
testContext,
105+
);
76106
tracker.trackFeedback({ kind: LDFeedbackKind.Negative });
77107

78108
expect(mockTrack).toHaveBeenCalledWith(
@@ -84,7 +114,13 @@ it('tracks negative feedback', () => {
84114
});
85115

86116
it('tracks success', () => {
87-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
117+
const tracker = new LDAIConfigTrackerImpl(
118+
mockLdClient,
119+
configKey,
120+
variationKey,
121+
version,
122+
testContext,
123+
);
88124
tracker.trackSuccess();
89125

90126
expect(mockTrack).toHaveBeenCalledWith(
@@ -96,7 +132,13 @@ it('tracks success', () => {
96132
});
97133

98134
it('tracks OpenAI usage', async () => {
99-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
135+
const tracker = new LDAIConfigTrackerImpl(
136+
mockLdClient,
137+
configKey,
138+
variationKey,
139+
version,
140+
testContext,
141+
);
100142
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
101143

102144
const TOTAL_TOKENS = 100;
@@ -148,7 +190,13 @@ it('tracks OpenAI usage', async () => {
148190
});
149191

150192
it('tracks error when OpenAI metrics function throws', async () => {
151-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
193+
const tracker = new LDAIConfigTrackerImpl(
194+
mockLdClient,
195+
configKey,
196+
variationKey,
197+
version,
198+
testContext,
199+
);
152200
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
153201

154202
const error = new Error('OpenAI API error');
@@ -181,7 +229,13 @@ it('tracks error when OpenAI metrics function throws', async () => {
181229
});
182230

183231
it('tracks Bedrock conversation with successful response', () => {
184-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
232+
const tracker = new LDAIConfigTrackerImpl(
233+
mockLdClient,
234+
configKey,
235+
variationKey,
236+
version,
237+
testContext,
238+
);
185239

186240
const TOTAL_TOKENS = 100;
187241
const PROMPT_TOKENS = 49;
@@ -236,7 +290,13 @@ it('tracks Bedrock conversation with successful response', () => {
236290
});
237291

238292
it('tracks Bedrock conversation with error response', () => {
239-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
293+
const tracker = new LDAIConfigTrackerImpl(
294+
mockLdClient,
295+
configKey,
296+
variationKey,
297+
version,
298+
testContext,
299+
);
240300

241301
const response = {
242302
$metadata: { httpStatusCode: 400 },
@@ -261,7 +321,13 @@ it('tracks Bedrock conversation with error response', () => {
261321
});
262322

263323
it('tracks tokens', () => {
264-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
324+
const tracker = new LDAIConfigTrackerImpl(
325+
mockLdClient,
326+
configKey,
327+
variationKey,
328+
version,
329+
testContext,
330+
);
265331

266332
const TOTAL_TOKENS = 100;
267333
const PROMPT_TOKENS = 49;
@@ -296,7 +362,13 @@ it('tracks tokens', () => {
296362
});
297363

298364
it('only tracks non-zero token counts', () => {
299-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
365+
const tracker = new LDAIConfigTrackerImpl(
366+
mockLdClient,
367+
configKey,
368+
variationKey,
369+
version,
370+
testContext,
371+
);
300372

301373
tracker.trackTokens({
302374
total: 0,
@@ -327,15 +399,27 @@ it('only tracks non-zero token counts', () => {
327399
});
328400

329401
it('returns empty summary when no metrics tracked', () => {
330-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
402+
const tracker = new LDAIConfigTrackerImpl(
403+
mockLdClient,
404+
configKey,
405+
variationKey,
406+
version,
407+
testContext,
408+
);
331409

332410
const summary = tracker.getSummary();
333411

334412
expect(summary).toEqual({});
335413
});
336414

337415
it('summarizes tracked metrics', () => {
338-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
416+
const tracker = new LDAIConfigTrackerImpl(
417+
mockLdClient,
418+
configKey,
419+
variationKey,
420+
version,
421+
testContext,
422+
);
339423

340424
tracker.trackDuration(1000);
341425
tracker.trackTokens({
@@ -363,7 +447,13 @@ it('summarizes tracked metrics', () => {
363447
});
364448

365449
it('tracks duration when async function throws', async () => {
366-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
450+
const tracker = new LDAIConfigTrackerImpl(
451+
mockLdClient,
452+
configKey,
453+
variationKey,
454+
version,
455+
testContext,
456+
);
367457
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
368458

369459
const error = new Error('test error');
@@ -382,7 +472,13 @@ it('tracks duration when async function throws', async () => {
382472
});
383473

384474
it('tracks error', () => {
385-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, version, testContext);
475+
const tracker = new LDAIConfigTrackerImpl(
476+
mockLdClient,
477+
configKey,
478+
variationKey,
479+
version,
480+
testContext,
481+
);
386482
tracker.trackError();
387483

388484
expect(mockTrack).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)