Skip to content

Commit

Permalink
working Complaint Detail view
Browse files Browse the repository at this point in the history
test update, restore detail slice temporary to test something

remove detail slice

working aggregations query

standardize fetch aggs into single hook

remove aggsslice

remove queryManager middleware

cleanup, remove more stuff

working map tab

logic to disable query hook

remove message middleware

list view working

cleanup, passing query params to api so we can extract to transformResponse

Save work

save work

move color map to api

remove query manager things

missing dep

more loogic to prevent query from firing when not initialized

working pagination, moved breakpoints to API, and passing them through pagination component

remove breakpoints from querySlice

cleanup

remove persist

clean up comments and errors

complaint detail test updates

save work, clearing out URL unused clode

cleanup

querySlice tests updated

trends test fixes

tile map test

squash lines

add prettier ignore file

updating tests, refactor product

save. working tests for Company filter

refactor

update dist

fixing pill test

issue test fix

restructure files

restore

update tests

save some work

trend depth toggle unit test

squash

moved files

focus header test fixes?

save stuff

searchpanel fix

fixing pagination

unit tests

fixing app.spec test

unit test actionbar

aggregation item test

condense

aggregation item test

aggregation item test

trends panel tests

print info tests

move file

unit test :(

working map panel test

simple filter fix

data export unit test

row test

tour test

line chart test

unit test fixes

delete detail

test for redux store

update unit tests

test coverage

update tests, fix condition causing url to not synch properly when copy/pasting url

fix cypress tests

fix url req call

move api hooks to folder
  • Loading branch information
flacoman91 committed Nov 21, 2024
1 parent 83287dc commit cd3d768
Show file tree
Hide file tree
Showing 193 changed files with 2,647 additions and 5,738 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/__fixtures__/**
**/fixture.js
7 changes: 3 additions & 4 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { defineConfig } = require('cypress')
const { defineConfig } = require('cypress');

module.exports = defineConfig({
viewportWidth: 1200,
Expand All @@ -8,13 +8,12 @@ module.exports = defineConfig({
requestTimeout: 20000,
screenshotOnRunFailure: false,
video: false,
experimentalFetchPolyfill: true,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
return require('./cypress/plugins/index.js')(on, config);
},
baseUrl: 'http://localhost:3000/',
},
})
});
6 changes: 1 addition & 5 deletions cypress/e2e/common/filters.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,12 @@ describe('Filter Panel', () => {
});

it('can trigger a pre-selected date range', () => {
const request = '**/geo/states/**';
const request = '**/geo/states?**&size=0';
const fixture = { fixture: 'common/get-geo.json' };
cy.intercept(request, fixture).as('getGeo');

cy.get('button.map').click();
cy.wait('@getGeo');
// TODO: This seemed to break for no reason. We may be able to remove this
// after fully converting to functional and react 18
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(750);
const maxDate = dayjs(new Date()).format('YYYY-MM-DD');
let minDate = dayjs(new Date()).subtract(3, 'years').format('YYYY-MM-DD');
cy.get('.date-ranges .a-btn.range-3y').contains('3y').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/document/document.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Document View', () => {
cy.intercept(request, fixture).as('getAggsResults');

request =
'?**&field=all&frm=0&has_narrative=true&no_aggs=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');

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

Large diffs are not rendered by default.

118 changes: 98 additions & 20 deletions dist/ccdb5.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/ccdb5.js.map

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions src/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,37 @@ import 'regenerator-runtime/runtime';
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 { ComplaintDetail } from './components/ComplaintDetail/ComplaintDetail';
import { waitFor } from './testUtils/test-utils';
import { configureStoreUtil, waitFor } from './testUtils/test-utils';
import fetchMock from 'jest-fetch-mock';
import { aggResponse } from './components/List/ListPanel/fixture';
import { trendsResponse } from './components/Trends/fixture';
jest.mock('highcharts/modules/accessibility');
jest.mock('highcharts/highmaps');

describe('initial state', () => {
let store;
beforeEach(() => {
fetchMock.resetMocks();
store = configureStoreUtil({ routes: { queryString: '??Fdsfdssdf' } });
});

it('renders search page', async () => {
fetchMock.mockResponse((req) => {
const url = new URL(req.url);
const params = url.searchParams;

if (params.get('size') === '0') {
// this is the list
return Promise.resolve({
body: JSON.stringify(aggResponse),
});
} else if (params.get('no_aggs')) {
return Promise.resolve({
body: JSON.stringify(trendsResponse),
});
}
});
const updateLocationHookSpy = jest.spyOn(
useUpdateLocationHook,
'useUpdateLocation',
Expand All @@ -22,6 +45,7 @@ describe('initial state', () => {
</Provider>,
);

await screen.findByText(/Search within/);
expect(updateLocationHookSpy).toBeCalledTimes(1);
expect(screen.getByText(/Consumer Complaint Database/)).toBeInTheDocument();
expect(screen.getByText(/Search within/)).toBeInTheDocument();
Expand Down
8 changes: 0 additions & 8 deletions src/actions/__fixtures__/emptyStore.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
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,
Expand Down
8 changes: 0 additions & 8 deletions src/actions/__mocks__/complaints.js

This file was deleted.

179 changes: 0 additions & 179 deletions src/actions/__tests__/complaints.spec.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Analytics from '../analytics';
import Analytics from './analytics';

describe('action:analytics', () => {
describe('.init()', () => {
Expand Down
Loading

0 comments on commit cd3d768

Please sign in to comment.