|
@@ -1,3 +1,5 @@
|
|
|
+import RouterFixture from 'sentry-fixture/routerFixture';
|
|
|
+
|
|
|
import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
|
import {act} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
@@ -34,7 +36,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
const key = `global-selection:${organization.slug}`;
|
|
|
|
|
|
beforeEach(() => {
|
|
|
- router = TestStubs.router();
|
|
|
+ router = RouterFixture();
|
|
|
localStorage.setItem(
|
|
|
key,
|
|
|
JSON.stringify({
|
|
@@ -424,7 +426,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('updates history when queries are different', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {project: '2'},
|
|
@@ -440,7 +442,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
});
|
|
|
it('does not update history when queries are the same', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {project: '1'},
|
|
@@ -455,7 +457,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('updates history when queries are different with replace', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {project: '2'},
|
|
@@ -470,7 +472,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('does not update history when queries are the same with replace', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {project: '1'},
|
|
@@ -482,7 +484,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('does not override an absolute date selection', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {project: '1', start: '2020-03-22T00:53:38', end: '2020-04-21T00:53:38'},
|
|
@@ -499,7 +501,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
|
|
|
describe('updateEnvironments()', function () {
|
|
|
it('updates single', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {environment: 'test'},
|
|
@@ -514,7 +516,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('updates multiple', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {environment: 'test'},
|
|
@@ -529,7 +531,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('removes environment', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {environment: 'test'},
|
|
@@ -543,7 +545,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('does not override an absolute date selection', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {
|
|
@@ -568,7 +570,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
|
|
|
describe('updateDateTime()', function () {
|
|
|
it('updates statsPeriod when there is no existing stats period', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {},
|
|
@@ -585,7 +587,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('updates statsPeriod when there is an existing stats period', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {statsPeriod: '14d'},
|
|
@@ -602,7 +604,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
});
|
|
|
|
|
|
it('changes to absolute date', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {statsPeriod: '24h'},
|
|
@@ -622,7 +624,7 @@ describe('PageFilters ActionCreators', function () {
|
|
|
|
|
|
describe('revertToPinnedFilters()', function () {
|
|
|
it('reverts all filters that are desynced from localStorage', function () {
|
|
|
- const router = TestStubs.router({
|
|
|
+ const router = RouterFixture({
|
|
|
location: {
|
|
|
pathname: '/test/',
|
|
|
query: {},
|