Commit 3f494241 by Erik Sundell Committed by Daniel Lee

stackdriver: test get metric types

parent 9c8593e7
...@@ -141,4 +141,37 @@ describe('StackdriverDataSource', () => { ...@@ -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');
});
});
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment