Skip to content

Commit fbc6114

Browse files
committed
fix tests for hive router runtime
1 parent 40fe24d commit fbc6114

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

packages/plugins/opentelemetry/tests/useOpenTelemetry.spec.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,22 +1082,36 @@ describe('useOpenTelemetry', () => {
10821082
code: SpanStatusCode.ERROR,
10831083
message: 'GraphQL Execution Error',
10841084
});
1085-
expect(operationSpan.span.attributes).toMatchObject({
1085+
1086+
const operationExpectedAttributes: Attributes = {
10861087
'hive.graphql.error.count': 1,
10871088
'hive.graphql.error.codes': ['TEST_ERROR'],
1088-
'hive.graphql.error.coordinates': ['Query.hello'],
1089-
});
1089+
};
1090+
if (!usingHiveRouterRuntime()) {
1091+
operationExpectedAttributes['hive.graphql.error.coordinates'] = [
1092+
'Query.hello',
1093+
];
1094+
}
1095+
expect(operationSpan.span.attributes).toMatchObject(
1096+
operationExpectedAttributes,
1097+
);
10901098

10911099
const errorEvent = operationSpan.span.events.find(
10921100
(event) => event.name === 'graphql.error',
10931101
);
10941102

1095-
expect(errorEvent?.attributes).toMatchObject({
1103+
const errorExpectedAttributes: Attributes = {
10961104
'hive.graphql.error.path': ['hello'],
10971105
'hive.graphql.error.message': 'Test Error',
10981106
'hive.graphql.error.code': 'TEST_ERROR',
1099-
'hive.graphql.error.coordinate': 'Query.hello',
1100-
});
1107+
};
1108+
if (!usingHiveRouterRuntime()) {
1109+
errorExpectedAttributes['hive.graphql.error.coordinate'] =
1110+
'Query.hello';
1111+
}
1112+
expect(errorEvent?.attributes).toMatchObject(
1113+
errorExpectedAttributes,
1114+
);
11011115
});
11021116
});
11031117
});

0 commit comments

Comments
 (0)