123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- import {
- generateReleaseWidgetFieldOptions,
- SESSIONS_FIELDS,
- } from 'sentry/views/dashboards/widgetBuilder/releaseWidget/fields';
- describe('generateReleaseWidgetFieldOptions', function () {
- const fields = Object.values(SESSIONS_FIELDS);
- const tagKeys = ['release', 'environment'];
- it('generates correct field options', function () {
- expect(generateReleaseWidgetFieldOptions(fields, tagKeys)).toEqual({
- 'field:session': {
- label: 'session',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'integer',
- name: 'session',
- },
- },
- },
- 'field:session.duration': {
- label: 'session.duration',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'duration',
- name: 'session.duration',
- },
- },
- },
- 'field:user': {
- label: 'user',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'string',
- name: 'user',
- },
- },
- },
- 'function:count_abnormal': {
- label: 'count_abnormal(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_abnormal',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_crashed': {
- label: 'count_crashed(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_crashed',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_errored': {
- label: 'count_errored(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_errored',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_healthy': {
- label: 'count_healthy(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_healthy',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_unique': {
- label: 'count_unique(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_unique',
- parameters: [
- {
- columnTypes: ['string'],
- defaultValue: 'user',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:crash_free_rate': {
- label: 'crash_free_rate(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'crash_free_rate',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:crash_rate': {
- label: 'crash_rate(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'crash_rate',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:sum': {
- label: 'sum(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'sum',
- parameters: [
- {
- columnTypes: ['integer'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'field:environment': {
- label: 'environment',
- value: {
- kind: 'field',
- meta: {
- dataType: 'string',
- name: 'environment',
- },
- },
- },
- 'field:release': {
- label: 'release',
- value: {
- kind: 'field',
- meta: {
- dataType: 'string',
- name: 'release',
- },
- },
- },
- });
- });
- });
|