Skip to content

Commit 7464048

Browse files
committed
test update
1 parent b57eeb4 commit 7464048

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

‎packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ export class BaggageBuilder {
234234
* @param pairs Dictionary or iterable of key-value pairs
235235
* @returns Self for method chaining
236236
*/
237-
setPairs(pairs: Record<string, any> | Iterable<[string, any]> | null | undefined): BaggageBuilder {
237+
setPairs(pairs: Record<string, unknown> | Iterable<[string, unknown]> | null | undefined): BaggageBuilder {
238238
if (!pairs) {
239239
return this;
240240
}
241241

242-
let entries: Iterable<[string, any]>;
242+
let entries: Iterable<[string, unknown]>;
243243
if (Symbol.iterator in Object(pairs)) {
244-
entries = pairs as Iterable<[string, any]>;
244+
entries = pairs as Iterable<[string, unknown]>;
245245
} else {
246246
entries = Object.entries(pairs);
247247
}

‎tests/observability/core/BaggageBuilder.test.ts‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ describe('BaggageBuilder', () => {
140140
.agentId('agent-456')
141141
.correlationId('corr-789')
142142
.sessionId('session-0001')
143+
.sessionDescription('My session desc')
143144
.build();
144145
const bag = propagation.getBaggage((scope as any).contextWithBaggage);
145146
expect(bag?.getEntry(OpenTelemetryConstants.SESSION_ID_KEY)?.value).toBe('session-0001');
147+
expect(bag?.getEntry(OpenTelemetryConstants.GEN_AI_SESSION_DESCRIPTION_KEY)?.value).toBe('My session desc');
146148
});
147149

148150
it('should omit empty sessionId value', () => {
@@ -152,26 +154,15 @@ describe('BaggageBuilder', () => {
152154
const bag = propagation.getBaggage((scope as any).contextWithBaggage);
153155
expect(bag?.getEntry(OpenTelemetryConstants.SESSION_ID_KEY)).toBeUndefined();
154156
});
155-
});
156157

157-
describe('sessionDescription support', () => {
158-
it('should set sessionDescription via fluent API', () => {
159-
const scope = new BaggageBuilder()
160-
.sessionDescription('My session desc')
161-
.build();
162-
const bag = propagation.getBaggage((scope as any).contextWithBaggage);
163-
expect(bag?.getEntry(OpenTelemetryConstants.GEN_AI_SESSION_DESCRIPTION_KEY)?.value).toBe('My session desc');
164-
});
165-
166-
it('should omit null sessionDescription value', () => {
158+
it('should omit null sessionDescription value', () => {
167159
const scope = new BaggageBuilder()
168160
.sessionDescription(null)
169161
.build();
170162
const bag = propagation.getBaggage((scope as any).contextWithBaggage);
171163
expect(bag?.getEntry(OpenTelemetryConstants.GEN_AI_SESSION_DESCRIPTION_KEY)).toBeUndefined();
172164
});
173165
});
174-
175166
});
176167

177168
describe('BaggageScope', () => {

0 commit comments

Comments
 (0)