mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
stackdriver: test get metric types
This commit is contained in:
@@ -141,4 +141,37 @@ describe('StackdriverDataSource', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when performing getMetricTypes', () => {
|
||||
describe('and call to stackdriver api succeeds', () => {});
|
||||
let ds;
|
||||
let result;
|
||||
beforeEach(async () => {
|
||||
const backendSrv = {
|
||||
async datasourceRequest() {
|
||||
return Promise.resolve({
|
||||
data: {
|
||||
metricDescriptors: [
|
||||
{
|
||||
displayName: 'test metric name 1',
|
||||
type: 'test metric type 1',
|
||||
},
|
||||
{
|
||||
displayName: 'test metric name 2',
|
||||
type: 'test metric type 2',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
ds = new StackdriverDataSource({}, backendSrv);
|
||||
result = await ds.getMetricTypes();
|
||||
});
|
||||
it('should return successfully', () => {
|
||||
expect(result.length).toBe(2);
|
||||
expect(result[0].id).toBe('test metric type 1');
|
||||
expect(result[0].name).toBe('test metric name 1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user