1
- import { Color , isEqualIgnoreFunctions } from '@hypertrace/common' ;
1
+ import { Color } from '@hypertrace/common' ;
2
2
import { GraphQlTimeRange , MetricAggregationType } from '@hypertrace/distributed-tracing' ;
3
3
import { GraphQlRequestCacheability , GraphQlRequestOptions } from '@hypertrace/graphql-client' ;
4
4
import { ModelApi } from '@hypertrace/hyperdash' ;
5
5
import { ObservabilityEntityType } from '../../../../graphql/model/schema/entity' ;
6
- import { ObservabilitySpecificationBuilder } from '../../../../graphql/request/builders/selections/observability-specification-builder' ;
7
6
import {
8
7
ENTITY_TOPOLOGY_GQL_REQUEST ,
9
8
TopologyNodeSpecification
@@ -15,7 +14,6 @@ import { TopologyMetricsModel } from './metrics/topology-metrics.model';
15
14
import { TopologyDataSourceModel } from './topology-data-source.model' ;
16
15
17
16
describe ( 'topology data source model' , ( ) => {
18
- const specBuilder = new ObservabilitySpecificationBuilder ( ) ;
19
17
const testTimeRange = { startTime : new Date ( 1568907645141 ) , endTime : new Date ( 1568911245141 ) } ;
20
18
let model ! : TopologyDataSourceModel ;
21
19
let lastEmittedQuery : unknown ;
@@ -93,47 +91,55 @@ describe('topology data source model', () => {
93
91
94
92
test ( 'builds expected request' , ( ) => {
95
93
model . getData ( ) ;
96
- expect (
97
- isEqualIgnoreFunctions ( lastEmittedQuery , {
98
- requestType : ENTITY_TOPOLOGY_GQL_REQUEST ,
99
- rootNodeType : ObservabilityEntityType . Service ,
100
- rootNodeSpecification : {
101
- titleSpecification : specBuilder . attributeSpecificationForKey ( 'name' ) ,
102
- metricSpecifications : [ specBuilder . metricAggregationSpecForKey ( 'numCalls' , MetricAggregationType . Average ) ]
103
- } ,
104
- rootNodeFilters : [ ] ,
105
- rootNodeLimit : 100 ,
106
- timeRange : new GraphQlTimeRange ( testTimeRange . startTime , testTimeRange . endTime ) ,
107
- downstreamNodeSpecifications : new Map < ObservabilityEntityType , TopologyNodeSpecification > ( [
108
- [
109
- ObservabilityEntityType . Api ,
110
- {
111
- titleSpecification : specBuilder . attributeSpecificationForKey ( 'name' ) ,
112
- metricSpecifications : [ specBuilder . metricAggregationSpecForKey ( 'numCalls' , MetricAggregationType . Average ) ]
113
- }
114
- ] ,
115
- [
116
- ObservabilityEntityType . Backend ,
117
- {
118
- titleSpecification : specBuilder . attributeSpecificationForKey ( 'name' ) ,
119
- metricSpecifications : [ specBuilder . metricAggregationSpecForKey ( 'numCalls' , MetricAggregationType . Average ) ]
120
- }
121
- ]
122
- ] ) ,
123
- upstreamNodeSpecifications : new Map < ObservabilityEntityType , TopologyNodeSpecification > ( [
124
- [
125
- ObservabilityEntityType . Service ,
126
- {
127
- titleSpecification : specBuilder . attributeSpecificationForKey ( 'name' ) ,
128
- metricSpecifications : [ specBuilder . metricAggregationSpecForKey ( 'numCalls' , MetricAggregationType . Average ) ]
129
- }
130
- ]
131
- ] ) ,
132
- edgeSpecification : {
133
- metricSpecifications : [ specBuilder . metricAggregationSpecForKey ( 'duration' , MetricAggregationType . Average ) ]
134
- }
135
- } )
136
- ) . toBe ( true ) ;
94
+ expect ( lastEmittedQuery ) . toEqual ( {
95
+ requestType : ENTITY_TOPOLOGY_GQL_REQUEST ,
96
+ rootNodeType : ObservabilityEntityType . Service ,
97
+ rootNodeSpecification : {
98
+ titleSpecification : expect . objectContaining ( { name : 'name' } ) ,
99
+ metricSpecifications : [
100
+ expect . objectContaining ( { metric : 'numCalls' , aggregation : MetricAggregationType . Average } )
101
+ ]
102
+ } ,
103
+ rootNodeFilters : [ ] ,
104
+ rootNodeLimit : 100 ,
105
+ timeRange : new GraphQlTimeRange ( testTimeRange . startTime , testTimeRange . endTime ) ,
106
+ downstreamNodeSpecifications : new Map < ObservabilityEntityType , TopologyNodeSpecification > ( [
107
+ [
108
+ ObservabilityEntityType . Api ,
109
+ {
110
+ titleSpecification : expect . objectContaining ( { name : 'name' } ) ,
111
+ metricSpecifications : [
112
+ expect . objectContaining ( { metric : 'numCalls' , aggregation : MetricAggregationType . Average } )
113
+ ]
114
+ }
115
+ ] ,
116
+ [
117
+ ObservabilityEntityType . Backend ,
118
+ {
119
+ titleSpecification : expect . objectContaining ( { name : 'name' } ) ,
120
+ metricSpecifications : [
121
+ expect . objectContaining ( { metric : 'numCalls' , aggregation : MetricAggregationType . Average } )
122
+ ]
123
+ }
124
+ ]
125
+ ] ) ,
126
+ upstreamNodeSpecifications : new Map < ObservabilityEntityType , TopologyNodeSpecification > ( [
127
+ [
128
+ ObservabilityEntityType . Service ,
129
+ {
130
+ titleSpecification : expect . objectContaining ( { name : 'name' } ) ,
131
+ metricSpecifications : [
132
+ expect . objectContaining ( { metric : 'numCalls' , aggregation : MetricAggregationType . Average } )
133
+ ]
134
+ }
135
+ ]
136
+ ] ) ,
137
+ edgeSpecification : {
138
+ metricSpecifications : [
139
+ expect . objectContaining ( { metric : 'duration' , aggregation : MetricAggregationType . Average } )
140
+ ]
141
+ }
142
+ } ) ;
137
143
138
144
expect ( lastEmittedQueryRequestOption ) . toEqual ( {
139
145
cacheability : GraphQlRequestCacheability . Cacheable ,
0 commit comments