|
@@ -32,6 +32,7 @@ describe('EventView constructor', function() {
|
|
|
statsPeriod: undefined,
|
|
|
environment: [],
|
|
|
yAxis: undefined,
|
|
|
+ display: undefined,
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -52,6 +53,7 @@ describe('EventView.fromLocation()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'p95',
|
|
|
+ display: 'previous',
|
|
|
},
|
|
|
};
|
|
|
|
|
@@ -72,6 +74,7 @@ describe('EventView.fromLocation()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'p95',
|
|
|
+ display: 'previous',
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -181,6 +184,7 @@ describe('EventView.fromSavedQuery()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
orderby: '-id',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'previous',
|
|
|
};
|
|
|
const eventView = EventView.fromSavedQuery(saved);
|
|
|
|
|
@@ -200,6 +204,7 @@ describe('EventView.fromSavedQuery()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: undefined,
|
|
|
+ display: 'previous',
|
|
|
});
|
|
|
|
|
|
const eventView2 = EventView.fromSavedQuery({
|
|
@@ -521,6 +526,7 @@ describe('EventView.generateQueryStringObject()', function() {
|
|
|
start: null,
|
|
|
end: undefined,
|
|
|
yAxis: undefined,
|
|
|
+ display: 'previous',
|
|
|
});
|
|
|
|
|
|
const expected = {
|
|
@@ -532,6 +538,7 @@ describe('EventView.generateQueryStringObject()', function() {
|
|
|
query: '',
|
|
|
project: [],
|
|
|
environment: [],
|
|
|
+ display: 'previous',
|
|
|
};
|
|
|
|
|
|
expect(eventView.generateQueryStringObject()).toEqual(expected);
|
|
@@ -553,6 +560,7 @@ describe('EventView.generateQueryStringObject()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'count()',
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
const eventView = new EventView(state);
|
|
@@ -570,6 +578,7 @@ describe('EventView.generateQueryStringObject()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'count()',
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
expect(eventView.generateQueryStringObject()).toEqual(expected);
|
|
@@ -611,6 +620,7 @@ describe('EventView.getEventsAPIPayload()', function() {
|
|
|
project: [567],
|
|
|
environment: ['prod'],
|
|
|
yAxis: 'users',
|
|
|
+ display: 'releases',
|
|
|
});
|
|
|
|
|
|
expect(eventView.getEventsAPIPayload({})).toEqual({
|
|
@@ -864,6 +874,7 @@ describe('EventView.getFacetsAPIPayload()', function() {
|
|
|
sort: 'the world',
|
|
|
project: '1234',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
},
|
|
|
};
|
|
|
|
|
@@ -893,6 +904,7 @@ describe('EventView.toNewQuery()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
it('outputs the right fields', function() {
|
|
@@ -913,6 +925,7 @@ describe('EventView.toNewQuery()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
range: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
expect(output).toEqual(expected);
|
|
@@ -941,6 +954,7 @@ describe('EventView.toNewQuery()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
range: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
expect(output).toEqual(expected);
|
|
@@ -969,6 +983,7 @@ describe('EventView.toNewQuery()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
range: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
expect(output).toEqual(expected);
|
|
@@ -1046,6 +1061,7 @@ describe('EventView.clone()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
const eventView = new EventView(state);
|
|
@@ -1659,46 +1675,6 @@ describe('EventView.withDeletedColumn()', function() {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-describe('EventView.withMovedColumn()', function() {
|
|
|
- const state = {
|
|
|
- id: '1234',
|
|
|
- name: 'best query',
|
|
|
- fields: [{field: 'count()'}, {field: 'project.id'}],
|
|
|
- sorts: generateSorts(['count']),
|
|
|
- query: 'event.type:error',
|
|
|
- project: [42],
|
|
|
- start: '2019-10-01T00:00:00',
|
|
|
- end: '2019-10-02T00:00:00',
|
|
|
- statsPeriod: '14d',
|
|
|
- environment: ['staging'],
|
|
|
- };
|
|
|
-
|
|
|
- it('returns itself when attempting to move column to the same placement', function() {
|
|
|
- const eventView = new EventView(state);
|
|
|
-
|
|
|
- const eventView2 = eventView.withMovedColumn({fromIndex: 0, toIndex: 0});
|
|
|
-
|
|
|
- expect(eventView2 === eventView).toBeTruthy();
|
|
|
- expect(eventView).toMatchObject(state);
|
|
|
- });
|
|
|
-
|
|
|
- it('move column', function() {
|
|
|
- const eventView = new EventView(state);
|
|
|
-
|
|
|
- const eventView2 = eventView.withMovedColumn({fromIndex: 0, toIndex: 1});
|
|
|
-
|
|
|
- expect(eventView2 !== eventView).toBeTruthy();
|
|
|
- expect(eventView).toMatchObject(state);
|
|
|
-
|
|
|
- const nextState = {
|
|
|
- ...state,
|
|
|
- fields: [...state.fields].reverse(),
|
|
|
- };
|
|
|
-
|
|
|
- expect(eventView2).toMatchObject(nextState);
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
describe('EventView.getSorts()', function() {
|
|
|
it('returns fields', function() {
|
|
|
const eventView = new EventView({
|
|
@@ -1875,6 +1851,7 @@ describe('EventView.isEqualTo()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'fam',
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
const eventView = new EventView(state);
|
|
@@ -1926,6 +1903,7 @@ describe('EventView.isEqualTo()', function() {
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
yAxis: 'fam',
|
|
|
+ display: 'releases',
|
|
|
};
|
|
|
|
|
|
const differences = {
|
|
@@ -1940,6 +1918,7 @@ describe('EventView.isEqualTo()', function() {
|
|
|
statsPeriod: '24d',
|
|
|
environment: [],
|
|
|
yAxis: 'ok boomer',
|
|
|
+ display: 'previous',
|
|
|
};
|
|
|
const eventView = new EventView(state);
|
|
|
|
|
@@ -1962,6 +1941,7 @@ describe('EventView.getResultsViewUrlTarget()', function() {
|
|
|
end: '2019-10-02T00:00:00',
|
|
|
statsPeriod: '14d',
|
|
|
environment: ['staging'],
|
|
|
+ display: 'previous',
|
|
|
};
|
|
|
const organization = TestStubs.Organization();
|
|
|
|
|
@@ -1971,6 +1951,7 @@ describe('EventView.getResultsViewUrlTarget()', function() {
|
|
|
expect(result.pathname).toEqual('/organizations/org-slug/discover/results/');
|
|
|
expect(result.query.query).toEqual(state.query);
|
|
|
expect(result.query.project).toEqual(state.project);
|
|
|
+ expect(result.query.display).toEqual(state.display);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -2337,20 +2318,6 @@ describe('isAPIPayloadSimilar', function() {
|
|
|
|
|
|
expect(results).toBe(false);
|
|
|
});
|
|
|
-
|
|
|
- it('is similar when a column is moved', function() {
|
|
|
- const thisEventView = new EventView(state);
|
|
|
- const location = {};
|
|
|
- const thisAPIPayload = thisEventView.getEventsAPIPayload(location);
|
|
|
-
|
|
|
- const otherEventView = thisEventView.withMovedColumn({fromIndex: 0, toIndex: 1});
|
|
|
- const otherLocation = {};
|
|
|
- const otherAPIPayload = otherEventView.getEventsAPIPayload(otherLocation);
|
|
|
-
|
|
|
- const results = isAPIPayloadSimilar(thisAPIPayload, otherAPIPayload);
|
|
|
-
|
|
|
- expect(results).toBe(true);
|
|
|
- });
|
|
|
});
|
|
|
|
|
|
describe('getFacetsAPIPayload', function() {
|