import { MOCK_GQL_COMPONENT, MOCK_METRIC_SOURCE, } from '../__tests__/fixtures/mocks'; import transformGqlComponent from './transformGqlComponent'; describe('transformGqlComponent', () => { describe('transforms metricSources', () => { test('no metricSources', () => { const { metricSources } = transformGqlComponent(MOCK_GQL_COMPONENT); expect(metricSources).toEqual([]); }); test('found one metricsSource', () => { const { metricSources } = transformGqlComponent({ ...MOCK_GQL_COMPONENT, metricSources: { pageInfo: { hasNextPage: false, hasPreviousPage: false, }, nodes: [MOCK_METRIC_SOURCE], }, }); expect(metricSources).toEqual([MOCK_METRIC_SOURCE]); }); }); describe('transforms fields', () => { test('no fields', () => { const { fields } = transformGqlComponent({ ...MOCK_GQL_COMPONENT, fields: null, }); expect(fields).toEqual({}); }); }); });