Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAP-1208 Convert reducers to RTK slices #482

Merged
merged 125 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
99e4fef
Saving work
Oct 19, 2023
7d34f7c
Saving work
Oct 20, 2023
e439c62
Saving work
Oct 23, 2023
4ef727c
Initial conversion complete
Oct 24, 2023
562b4a5
Saving work
Oct 24, 2023
29c4ab1
Fixed silly misnaming error with aggs
Oct 26, 2023
aec3eb9
Saving work
Oct 27, 2023
f9dc97a
DATAP-1208
Nov 9, 2023
aadbd82
Making progress changing tabs, might make another branch and start ov…
Nov 9, 2023
41a327a
Starting to implement fixes from alt branch
Nov 16, 2023
4a1fbf5
View actions mainly renamed, filter working
Nov 16, 2023
59a92af
DATAP-1208 quick commit to see if Jira will pick this up
Nov 16, 2023
a09537c
Merge branch 'WW-DATAP-1208-reducers-use-slices' of https://github.co…
Nov 16, 2023
21584c1
Saving work
Nov 17, 2023
29ce692
All view actions relocated and refactored
Nov 17, 2023
87e5c4f
Working on query reducer actions
Nov 20, 2023
155e6e0
Date change updated
Nov 20, 2023
0f999f0
Change date range working
Nov 20, 2023
ef6b4df
Filter actions all converted to reducers in slices, filter action fil…
Nov 21, 2023
a986766
Map actions converted to reducers in slices and action file deleted
Nov 21, 2023
2a658e7
Paging actions converted, file deleted
Nov 21, 2023
289e71e
Trends actions converted and file deleted
Nov 22, 2023
a8a6d56
Updated ExportConfirmation spec
Nov 24, 2023
9001041
Detail spec (reducer) updated
Nov 24, 2023
5fa14c1
ListPanel spec updated
Nov 24, 2023
e118919
Pagination spec updated
Nov 24, 2023
88eb84a
DataExport spec updated
Nov 24, 2023
49b6eba
ActionBar spec updated
Nov 24, 2023
12367e9
PerCapita spec updated
Nov 24, 2023
4f223b1
ChartToggles, NarrativesButtons specs updated
Nov 24, 2023
a8afbe9
RootModal spec updated
Nov 24, 2023
debc572
Results reducer spec updated
Nov 24, 2023
2ebb191
Map reducer spec updated
Nov 24, 2023
82eaaf3
More work on trends spec, most of view spec
Nov 28, 2023
a3d50ab
FederalState spec fixed
Nov 28, 2023
3e3d79e
Filter component specs updated
Nov 28, 2023
3f49100
Hero and SearchBar specs updated
Nov 28, 2023
32f5760
Agg reducer spec fixed
Nov 28, 2023
eb2beab
View spec fixed
Nov 28, 2023
f269390
Pausing work briefly
Nov 29, 2023
427d60c
Saving work
Nov 30, 2023
60797d9
Trends portion of query tests updated
Dec 1, 2023
6f8acce
Map section of query spec updated
Dec 4, 2023
ac104dd
Saving work
Dec 5, 2023
c287f99
Dates tests fixed in query
Dec 6, 2023
c987192
Remove filters tests in query
Dec 8, 2023
30bda1b
Saving work
Dec 12, 2023
945307b
Saving work
Dec 18, 2023
8258757
Saving work
Dec 18, 2023
62550f1
Saving work
Dec 19, 2023
85b8e23
Saving
Dec 19, 2023
edf17ca
Agg spec fixed, removes 'stack' from error handling as it is non-stan…
Dec 20, 2023
fa97450
Saving work
Dec 20, 2023
09f1294
All tests passing
Dec 21, 2023
ae5cbbf
Fixed payload sections in query slice
Dec 26, 2023
42f498a
Fixed up some prepare functions
Dec 27, 2023
6656564
Saving work fixing tests
Jan 2, 2024
8474059
Saving work
Jan 4, 2024
806acfb
Tests finished, updates made
Jan 9, 2024
a3cdd6a
Built dist
Feb 7, 2024
e7c8a64
Merge fixes
Feb 8, 2024
7e65718
Fixed list
Feb 8, 2024
04d3c01
Saving work
Feb 9, 2024
df5b2cc
Fixed requery meta value for Trends
Feb 13, 2024
abdb447
Fixed error with TileMap
Feb 14, 2024
ec87026
Checks if tooltip value has property before trying to assign a fallba…
Feb 14, 2024
ba1e364
Fix to detail reducer
Feb 14, 2024
7500fed
Merge fix, still needs lint fixes
Mar 1, 2024
ca41450
Lints fixed
Mar 4, 2024
a2e4fb9
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
Mar 4, 2024
63803af
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 Mar 5, 2024
c74ea0d
linting fixes,
flacoman91 Mar 8, 2024
17e8f07
fixing row chart on trends page
flacoman91 Mar 8, 2024
93052f2
adding debounce to stacked area and line chart onMove
flacoman91 Mar 11, 2024
922d86d
fixing results tests
flacoman91 Mar 12, 2024
9f64169
painful date manipulation
flacoman91 Mar 12, 2024
2439984
fix map test
flacoman91 Mar 12, 2024
226d490
fixing date converions
flacoman91 Mar 12, 2024
debbfd1
fixing broken test
flacoman91 Mar 12, 2024
ad9938b
restoring some uncommented tests
flacoman91 Mar 12, 2024
74bb136
adding action logger, fixing a test, refactor action calls, rename so…
flacoman91 Mar 12, 2024
46e1cbb
fixing up tests and fix broken references
flacoman91 Mar 12, 2024
df854e4
trends reducer test updates
flacoman91 Mar 12, 2024
44e5f70
query reducer tests
flacoman91 Mar 12, 2024
e4c0507
convert company, filterPanel to functional components, remove snapsho…
flacoman91 Mar 13, 2024
3f9fa61
fixing test references
flacoman91 Mar 13, 2024
b7b429f
fixing problems with reducers
flacoman91 Mar 13, 2024
15a73db
Merge commit '7cadd7339f83218cbbca4b557e61b07961e397c2' into WW-DATAP…
flacoman91 Mar 13, 2024
4429c20
save off filters reducer
flacoman91 Mar 13, 2024
5df9acd
Merge commit '4bd243453c3cfedc5e60c4611d6b706478194924' into WW-DATAP…
flacoman91 Apr 12, 2024
545d9ee
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 Apr 17, 2024
6c4543e
merged
flacoman91 May 1, 2024
ff4aabf
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 May 1, 2024
187b51b
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 May 3, 2024
7b48940
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 May 3, 2024
12b992d
Merge commit 'fddf2b6b16aa110a8da19cbc1243721f7138f438' into WW-DATAP…
flacoman91 May 20, 2024
b600de4
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 Jul 19, 2024
7f74ad6
merge updates to aggregationitem
flacoman91 Jul 29, 2024
ba487c5
Merge commit '1049e6457d1e4caea03ebf527ac1916cfad8e993' into WW-DATAP…
flacoman91 Aug 2, 2024
0426d28
update tests
flacoman91 Aug 2, 2024
7f296e5
merge
flacoman91 Aug 7, 2024
655d46c
remove old test
flacoman91 Aug 7, 2024
a16e536
adding some default vals, merge from main
flacoman91 Aug 19, 2024
1d06bd1
merge main
flacoman91 Aug 20, 2024
0474e2b
filters replaced
flacoman91 Aug 23, 2024
58d9e5f
update code, working aggregation branch
flacoman91 Aug 23, 2024
bd9d7f2
cleanup
flacoman91 Aug 23, 2024
c37ad79
merge main
flacoman91 Aug 24, 2024
70d4592
merged from main, updated functional components
flacoman91 Sep 6, 2024
7f72bbb
removed linechart file
flacoman91 Sep 6, 2024
30104b3
merge from main
flacoman91 Sep 10, 2024
92c2d79
convert objects to strings
flacoman91 Sep 10, 2024
83a0db6
fixing non serializable object
flacoman91 Sep 10, 2024
97e6045
merge main
flacoman91 Sep 11, 2024
88c45ee
fixing reference
flacoman91 Sep 11, 2024
7abccbb
merge
flacoman91 Sep 18, 2024
8f1945d
fix component unit tests
flacoman91 Sep 18, 2024
cf308cb
Merge branch 'main' into WW-DATAP-1208-reducers-use-slices
flacoman91 Sep 23, 2024
6906e1b
Merge commit '601b5ee6114dd18941864025a7ef96319deac498' into WW-DATAP…
flacoman91 Sep 23, 2024
3684f98
merge from main
flacoman91 Sep 24, 2024
cfdd8aa
merge main
flacoman91 Oct 7, 2024
9553cf8
fix app test
flacoman91 Oct 8, 2024
ec3a36e
Merge commit 'e44a5774e15dd8139bc092484d5e753bcd336438' into WW-DATAP…
flacoman91 Oct 22, 2024
426d0ef
wait
flacoman91 Oct 23, 2024
435fdbe
wait
flacoman91 Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cypress/e2e/common/filters.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ describe('Filter Panel', () => {
fixture = { fixture: 'common/get-complaints-date-to.json' };
cy.intercept(request, fixture).as('getComplaintsDateTo');

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500);
cy.log('is expanded');

cy.get('#date_received-from').should('be.visible');
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/document/document.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ describe('Document View', () => {
cy.intercept(request, fixture).as('getAggsResults');

request =
'?**&field=all&has_narrative=true&search_term=pizza&size=10&sort=relevance_desc';
'?**&field=all&frm=0&has_narrative=true&no_aggs=true&search_term=pizza&size=10&sort=relevance_desc';
fixture = { fixture: 'document/get-results.json' };
cy.intercept(request, fixture).as('getResults');

cy.intercept('GET', '/_suggest/?text=pizza', []);

cy.visit(
'?searchText=pizza&has_narrative=true&size=10&sort=relevance_desc&tab=List'
'?searchText=pizza&has_narrative=true&size=10&sort=relevance_desc&tab=List',
);

cy.get('select#select-sort option:selected').should(
'have.text',
'Relevance'
'Relevance',
);

cy.contains('.pill', 'Has narrative').should('be.visible');
Expand All @@ -82,7 +82,7 @@ describe('Document View', () => {

cy.get('select#select-sort option:selected').should(
'have.text',
'Relevance'
'Relevance',
);

cy.contains('.pill', 'Has narrative').should('be.visible');
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/document/get-complaints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cypress/fixtures/document/get-detail.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"took":11,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":1.0,"hits":[{"_index":"complaint-public-v2","_type":"_doc","_id":"3146099","_score":1.0,"_source":{"product":"Credit card or prepaid card","complaint_what_happened":"my card has been declined for \" suspicious '' purchases and they are not able to prevent, or remedy the problem. I've worked with them multiple times and after excessive hold times on each call, it continues and can't seem to be fixed. \n\nEach time I call it's a different excuse. \n\nThis started in early XXXX of XXXX and has occurred in XXXX, XXXX, XXXX of XXXX, XXXX of XXXX and XX/XX/XXXX. \n\nThe purchases were for the following : 1. Pizza at local Pizza shop. ( 1 block from house ) 2. XXXX XXXX for prescription medicine and household ( 2 miles from home ) 3. Online game service using a virtual card number that was exclusively provided by capital one for this service.","date_sent_to_company":"2019-02-07T12:00:00-05:00","issue":"Trouble using your card",":updated_at":1639539163,"date_received_formatted":"02/07/19","sub_product":"General-purpose credit card or charge card","zip_code":"19438","tags":null,"has_narrative":true,"complaint_id":"3146099","date_sent_to_company_formatted":"02/07/19","timely":"Yes","consumer_consent_provided":"Consent provided","company_response":"Closed with explanation","date_indexed":"2021-12-15T12:00:00-05:00","submitted_via":"Web","date_indexed_formatted":"12/15/21","company":"CAPITAL ONE FINANCIAL CORPORATION","date_received":"2019-02-07T12:00:00-05:00","state":"PA","consumer_disputed":"N/A","company_public_response":null,"sub_issue":"Can't use card to make purchases"}}]}}
{"took": 11, "timed_out": false, "_shards": { "total": 5, "successful": 5, "skipped": 0, "failed": 0 }, "hits": {"total": { "value": 1, "relation": "eq" }, "max_score": 1.0, "hits": [{"_index": "complaint-public-v2", "_type": "_doc", "_id": "3146099", "_score": 1.0, "_source": {"product": "Credit card or prepaid card", "complaint_what_happened": "my card has been declined for \" suspicious '' purchases and they are not able to prevent, or remedy the problem. I've worked with them multiple times and after excessive hold times on each call, it continues and can't seem to be fixed. \n\nEach time I call it's a different excuse. \n\nThis started in early XXXX of XXXX and has occurred in XXXX, XXXX, XXXX of XXXX, XXXX of XXXX and XX/XX/XXXX. \n\nThe purchases were for the following : 1. Pizza at local Pizza shop. ( 1 block from house ) 2. XXXX XXXX for prescription medicine and household ( 2 miles from home ) 3. Online game service using a virtual card number that was exclusively provided by capital one for this service.", "date_sent_to_company": "2019-02-07T12:00:00-05:00", "issue": "Trouble using your card", ":updated_at": 1639539163, "date_received_formatted": "02/07/19", "sub_product": "General-purpose credit card or charge card", "zip_code": "19438", "tags": null, "has_narrative": true, "complaint_id": "3146099", "date_sent_to_company_formatted": "02/07/19", "timely": "Yes", "consumer_consent_provided": "Consent provided", "company_response": "Closed with explanation", "date_indexed": "2021-12-15T12:00:00-05:00", "submitted_via": "Web", "date_indexed_formatted": "12/15/21", "company": "CAPITAL ONE FINANCIAL CORPORATION", "date_received": "2019-02-07T12:00:00-05:00", "state": "PA", "consumer_disputed": "N/A", "company_public_response": null, "sub_issue": "Can't use card to make purchases"}}]}}
4 changes: 2 additions & 2 deletions dist/ccdb5.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ccdb5.css.map

Large diffs are not rendered by default.

119 changes: 59 additions & 60 deletions dist/ccdb5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ccdb5.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
],
"coverageThreshold": {
"global": {
"branches": 85,
"functions": 89,
"lines": 93,
"statements": 93
"branches": 86,
"functions": 94,
"lines": 94,
"statements": 94
}
},
"coverageReporters": [
Expand Down
40 changes: 7 additions & 33 deletions src/App.spec.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,39 @@
import App from './App';
import { Provider } from 'react-redux';
import 'regenerator-runtime/runtime';
import { render, screen, waitFor } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { render, screen } from '@testing-library/react';
import * as useUpdateLocationHook from './hooks/useUpdateLocation';
import store from './app/store';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { ComplaintDetail } from './components/ComplaintDetail/ComplaintDetail';

import { waitFor } from './testUtils/test-utils';
jest.mock('highcharts/modules/accessibility');
jest.mock('highcharts/highmaps');

describe('initial state', () => {
it('renders search page', () => {
it('renders search page', async () => {
const updateLocationHookSpy = jest.spyOn(
useUpdateLocationHook,
'useUpdateLocation',
);

render(
<Provider store={store}>
<App />
</Provider>,
);

expect(updateLocationHookSpy).toBeCalled();

expect(updateLocationHookSpy).toBeCalledTimes(1);
expect(screen.getByText(/Consumer Complaint Database/)).toBeInTheDocument();
expect(screen.getByText(/Search within/)).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /Show advanced search tips/ }),
).toBeInTheDocument();
});

it('renders tour button', async () => {
const updateLocationHookSpy = jest
.spyOn(useUpdateLocationHook, 'useUpdateLocation')
.mockImplementation(() => jest.fn());

render(
<Provider store={store}>
<App />
</Provider>,
);

expect(updateLocationHookSpy).toBeCalled();

expect(screen.getByText(/Consumer Complaint Database/)).toBeInTheDocument();
expect(screen.getByText(/Search within/)).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /Show advanced search tips/ }),
).toBeInTheDocument();

await waitFor(() => {
expect(
screen.getByRole('button', { name: /Take a tour/ }),
).toBeInTheDocument();
});
});
}, 10000);

it('renders the detail route', () => {
render(
Expand All @@ -74,10 +51,7 @@ describe('initial state', () => {
).toBeInTheDocument();
expect(
screen.getByRole('link', { name: /Back to search results/ }),
).toHaveAttribute(
'href',
'/?chartType=line&dateInterval=Month&dateRange=3y&date_received_max=2020-05-05&date_received_min=2017-05-05&lens=Product&searchField=all&subLens=sub_product&tab=Trends',
);
).toHaveAttribute('href', '/');

expect(screen.getByText('This page is loading')).toBeInTheDocument();
});
Expand Down
18 changes: 11 additions & 7 deletions src/actions/__fixtures__/emptyStore.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { defaultAggs as aggs } from '../../reducers/aggs/aggs';
import { defaultDetail as detail } from '../../reducers/detail/detail';
import { defaultMap as map } from '../../reducers/map/map';
import { defaultQuery as query } from '../../reducers/query/query';
import { defaultTrends as trends } from '../../reducers/trends/trends';
import { defaultResults as results } from '../../reducers/results/results';
import { defaultView as view } from '../../reducers/view/view';
import { aggsState as aggs } from '../../reducers/aggs/aggsSlice';
import { detailState as detail } from '../../reducers/detail/detailSlice';
import { filtersState as filters } from '../../reducers/filters/filtersSlice';
import { mapState as map } from '../../reducers/map/mapSlice';
import { queryState as query } from '../../reducers/query/querySlice';
import { resultsState as results } from '../../reducers/results/resultsSlice';
import { routesState as routes } from '../../reducers/routes/routesSlice';
import { trendsState as trends } from '../../reducers/trends/trendsSlice';
import { viewState as view } from '../../reducers/view/viewSlice';

export default Object.freeze({
aggs,
detail,
filters,
map,
query,
results,
routes,
trends,
view,
});
61 changes: 40 additions & 21 deletions src/actions/__tests__/complaints.spec.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
import * as sut from '..';
import * as constants from '../../constants';
import { initialState, setupStore } from '../../testUtils/setupStore';
import {
AGGREGATIONS_API_CALLED,
COMPLAINT_DETAIL_CALLED,
COMPLAINTS_API_CALLED,
STATES_API_CALLED,
TRENDS_API_CALLED,
} from '..';

describe('action::complaints', () => {
let expectedHitsQS, expectedQS, fixtureStore;

beforeEach(() => {
expectedHitsQS =
'@@API?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&size=25&sort=created_date_desc';
'@@API?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&frm=0&no_aggs=true&size=25&sort=created_date_desc';
});
describe('getAggregations', () => {
beforeEach(() => {
fixtureStore = initialState();
fixtureStore.query.tab = constants.MODE_LIST;
expectedQS =
'@@API?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&sort=created_date_desc&size=0';
'@@API?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&size=0';
});

it('executes a chain of actions', function () {
fixtureStore.view.tab = constants.MODE_LIST;

const store = setupStore(fixtureStore);
const url = expectedQS;
const expectedActions = [sut.callingApi(AGGREGATIONS_API_CALLED, url)];

const expectedActions = [
sut.aggregationsApiCalled(url),
sut.httpGet(url, sut.aggregationsReceived, sut.aggregationsApiFailed),
];
store.dispatch(sut.getAggregations());
const { actions } = store.getState().actions;
expect(actions).toEqual(expectedActions);
Expand All @@ -49,13 +47,18 @@ describe('action::complaints', () => {
beforeEach(() => {
fixtureStore = initialState();
expectedUrl = expectedHitsQS;
fixtureStore.query.tab = constants.MODE_LIST;
fixtureStore.view.tab = constants.MODE_LIST;
});

it('executes a chain of actions', function () {
const store = setupStore(fixtureStore);
const expectedActions = [
sut.callingApi(COMPLAINTS_API_CALLED, expectedUrl),
sut.complaintsApiCalled(expectedUrl),
sut.httpGet(
expectedUrl,
sut.complaintsReceived,
sut.complaintsApiFailed,
),
];
store.dispatch(sut.getComplaints());
const { actions } = store.getState().actions;
Expand All @@ -78,14 +81,19 @@ describe('action::complaints', () => {

beforeEach(() => {
fixtureStore = initialState();
fixtureStore.query.tab = constants.MODE_DOCUMENT;
fixtureStore.view.tab = constants.MODE_DETAIL;
expectedUrl = '@@API123';
});

it('executes a series of actions', function () {
const store = setupStore(fixtureStore);
const expectedActions = [
sut.callingApi(COMPLAINT_DETAIL_CALLED, expectedUrl),
sut.complaintDetailCalled(expectedUrl),
sut.httpGet(
expectedUrl,
sut.complaintDetailReceived,
sut.complaintDetailFailed,
),
];
store.dispatch(sut.getComplaintDetail(123));
const { actions } = store.getState().actions;
Expand All @@ -107,14 +115,19 @@ describe('action::complaints', () => {

beforeEach(() => {
fixtureStore = initialState();
fixtureStore.query.tab = constants.MODE_MAP;
fixtureStore.view.tab = constants.MODE_MAP;
expectedUrl =
'@@APIgeo/states/?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&no_aggs=true';
'@@APIgeo/states/?date_received_max=2020-05-05' +
'&date_received_min=2017-05-05&field=all&frm=0&no_aggs=true' +
'&size=25&sort=created_date_desc';
});

it('executes a series of actions', function () {
const store = setupStore(fixtureStore);
const expectedActions = [sut.callingApi(STATES_API_CALLED, expectedUrl)];
const expectedActions = [
sut.statesApiCalled(expectedUrl),
sut.httpGet(expectedUrl, sut.statesReceived, sut.statesApiFailed),
];
store.dispatch(sut.getStates());
const { actions } = store.getState().actions;
expect(actions).toEqual(expectedActions);
Expand All @@ -135,14 +148,20 @@ describe('action::complaints', () => {

beforeEach(() => {
fixtureStore = initialState();
fixtureStore.query.tab = constants.MODE_TRENDS;
fixtureStore.view.tab = constants.MODE_TRENDS;
expectedUrl =
'@@APItrends/?date_received_max=2020-05-05&date_received_min=2017-05-05&field=all&lens=product&sub_lens=sub_product&trend_depth=5&trend_interval=month&no_aggs=true';
'@@APItrends?date_received_max=2020-05-05' +
'&date_received_min=2017-05-05&field=all&frm=0&lens=product' +
'&no_aggs=true&searchField=all&size=25&sort=created_date_desc' +
'&sub_lens=sub_product&trend_depth=5&trend_interval=month';
});

it('executes a series of actions', function () {
const store = setupStore(fixtureStore);
const expectedActions = [sut.callingApi(TRENDS_API_CALLED, expectedUrl)];
const expectedActions = [
sut.trendsApiCalled(expectedUrl),
sut.httpGet(expectedUrl, sut.trendsReceived, sut.trendsApiFailed),
];
store.dispatch(sut.getTrends());
const { actions } = store.getState().actions;
expect(actions).toEqual(expectedActions);
Expand Down
Loading