diff --git a/public/app/plugins/datasource/stackdriver/components/Aggregations.test.tsx b/public/app/plugins/datasource/stackdriver/components/Aggregations.test.tsx
new file mode 100644
index 00000000000..7bc2c3cb536
--- /dev/null
+++ b/public/app/plugins/datasource/stackdriver/components/Aggregations.test.tsx
@@ -0,0 +1,56 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import { Aggregations, Props } from './Aggregations';
+import { shallow } from 'enzyme';
+import { ValueTypes, MetricKind } from '../constants';
+
+const props: Props = {
+ onChange: () => {},
+ templateSrv: {},
+ metricDescriptor: {
+ valueType: '',
+ metricKind: '',
+ },
+ crossSeriesReducer: '',
+ groupBys: [],
+ children: renderProps =>
,
+};
+
+describe('Aggregations', () => {
+ let wrapper;
+ it('renders correctly', () => {
+ const tree = renderer.create().toJSON();
+ expect(tree).toMatchSnapshot();
+ });
+
+ describe('options', () => {
+ describe('when DOUBLE and DELTA is passed as props', () => {
+ beforeEach(() => {
+ const newProps = { ...props, metricDescriptor: { valueType: ValueTypes.DOUBLE, metricKind: MetricKind.GAUGE } };
+ wrapper = shallow();
+ });
+ it('', () => {
+ const options = wrapper.state().aggOptions[0].options;
+ expect(options.length).toEqual(11);
+ expect(options.map(o => o.value)).toEqual(
+ expect.not.arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
+ );
+ });
+ });
+
+ describe('when MONEY and CUMULATIVE is passed as props', () => {
+ beforeEach(() => {
+ const newProps = {
+ ...props,
+ metricDescriptor: { valueType: ValueTypes.MONEY, metricKind: MetricKind.CUMULATIVE },
+ };
+ wrapper = shallow();
+ });
+ it('', () => {
+ const options = wrapper.state().aggOptions[0].options;
+ expect(options.length).toEqual(1);
+ expect(options.map(o => o.value)).toEqual(expect.arrayContaining(['REDUCE_NONE']));
+ });
+ });
+ });
+});
diff --git a/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx b/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
index d752d59261f..f0a311e62e3 100644
--- a/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
+++ b/public/app/plugins/datasource/stackdriver/components/Aggregations.tsx
@@ -16,7 +16,7 @@ export interface Props {
children?: (renderProps: any) => JSX.Element;
}
-interface State {
+export interface State {
aggOptions: any[];
displayAdvancedOptions: boolean;
}
@@ -79,13 +79,9 @@ export class Aggregations extends React.Component {
diff --git a/public/app/plugins/datasource/stackdriver/components/__snapshots__/Aggregations.test.tsx.snap b/public/app/plugins/datasource/stackdriver/components/__snapshots__/Aggregations.test.tsx.snap
new file mode 100644
index 00000000000..defd8ef01a4
--- /dev/null
+++ b/public/app/plugins/datasource/stackdriver/components/__snapshots__/Aggregations.test.tsx.snap
@@ -0,0 +1,119 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Aggregations renders correctly 1`] = `
+Array [
+
+
+
+
+
+
+
+ Select Aggregation
+
+
+
+
+
+
+
+
+
+
+
,
+ ,
+]
+`;
diff --git a/public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap b/public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
index 161f35563e5..00a1ac95039 100644
--- a/public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
+++ b/public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
@@ -276,7 +276,6 @@ Array [
>
Advanced Options