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

APPEALS-51237, APPEALS-51536: Optimize feature tests in intake/appeal/edit_spec.rb and optimize automatic case distribution tests #22280

Merged
merged 34 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
edb1080
refactoring edit_spec
craigrva Jul 9, 2024
2f824bd
move one assertion and remove duplicate test
craigrva Jul 10, 2024
6ab9df1
refactor withdraw issues context
craigrva Jul 10, 2024
fa5b7b3
move duplicate test assertions
craigrva Jul 11, 2024
1a5c83f
move duplicate test assertions to existing tests and remove duplicate…
craigrva Jul 11, 2024
0ccf3da
move assertion and remove duplicate test
craigrva Jul 11, 2024
dd124a8
consolidate SCT appeal tests
craigrva Jul 11, 2024
411860e
refactor SCT tests to use step blocks
craigrva Jul 11, 2024
4a523f1
consolidate a individual test into a step
craigrva Jul 11, 2024
8131dd6
move CC appeal task tests to appeals_controller_spec intead of a feat…
craigrva Jul 12, 2024
2f243dd
remove unnecessary code comments
craigrva Jul 12, 2024
05f1f27
consolidate member not admin tests
craigrva Jul 15, 2024
91d0af6
remove commented portions of test
craigrva Jul 15, 2024
7ba0778
move tests from affinity_days_levers_spec.rb
craigrva Jul 15, 2024
f391519
move tests from affinity_days_levers_spec.rb, last commit was from au…
craigrva Jul 15, 2024
09eed2d
remove ama_np_dist_goals_by_docket_lever_spec.rb
craigrva Jul 15, 2024
f1faa60
remove batch_size_levers_spec.rb
craigrva Jul 15, 2024
03639cc
remove inactive_data_elements_levers_spec.rb
craigrva Jul 15, 2024
90db15e
remove lever_buttons_spec.rb
craigrva Jul 15, 2024
77318d0
refactor
craigrva Jul 15, 2024
58360d2
move jest file for convention, add snapshot
craigrva Jul 16, 2024
41c9e6e
move test for admin ui not interactable for non-admins to a jest test
craigrva Jul 16, 2024
817b38c
remove unnecessary comments, whitespace
craigrva Jul 16, 2024
49a45af
restore jest folder structure
craigrva Jul 19, 2024
a43b4df
Merge branch 'master' of https://github.com/department-of-veterans-af…
craigrva Jul 19, 2024
8b51f90
modify edit spec to use case details page instead of searching again
craigrva Jul 19, 2024
f56e257
modify assertions
craigrva Jul 19, 2024
5566428
remove TODO comment
craigrva Jul 19, 2024
d26ac7b
add assertion to allow async save actions to be executed
craigrva Jul 19, 2024
77795a6
add check to ensure banner is gone before trying to save
craigrva Jul 19, 2024
90c207b
refactor assertions for lever history display
craigrva Jul 19, 2024
028889e
fix failing dependency report tests
craigrva Jul 24, 2024
6dd23c9
Merge branch 'craig/APPEALS-51536-2' of https://github.com/department…
craigrva Jul 24, 2024
562c6d8
Merge branch 'master' into craig/APPEALS-51237-51536
craigrva Jul 29, 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
66 changes: 59 additions & 7 deletions client/test/app/caseDistribution/pages/CaseDistributionApp.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import React from 'react';
import CaseDistributionApp from 'app/caseDistribution/pages/CaseDistributionApp';
import {
history as leverHistory,
mockAffinityDaysLevers,
mockBatchLevers,
mockDocketDistributionPriorLevers,
mockDocketTimeGoalsLevers,
mockStaticLevers
} from '../../../data/adminCaseDistributionLevers';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import rootReducer from 'app/caseDistribution/reducers/root';
import thunk from 'redux-thunk';
import { mount } from 'enzyme';
import { render } from '@testing-library/react';

describe('render Case Distribution Application', () => {

Expand All @@ -13,26 +22,26 @@ describe('render Case Distribution Application', () => {
applyMiddleware(thunk));

let testLevers = {
static: [],
batch: [],
affinity: [],
docket_distribution_prior: [],
docket_time_goal: []
static: mockStaticLevers,
batch: mockBatchLevers,
affinity: mockAffinityDaysLevers,
docket_distribution_prior: mockDocketDistributionPriorLevers,
docket_time_goal: mockDocketTimeGoalsLevers
};

afterEach(() => {
jest.clearAllMocks();
});

it('renders Case Distribution App', () => {
it('renders Case Distribution App as editable for an admin', () => {
const store = getStore();

let wrapper = mount(
<Provider store={store}>
<CaseDistributionApp
acdLeversForStore={testLevers}
acd_levers={testLevers}
acd_history={[]}
acd_history={leverHistory}
user_is_an_acd_admin
/>
</Provider>
Expand All @@ -43,7 +52,50 @@ describe('render Case Distribution Application', () => {
expect(wrapper.find('#lever-history-table').exists()).toBeTruthy();
expect(wrapper.find('.inactive-data-content').exists()).toBeTruthy();
expect(wrapper.find('.lever-content').exists()).toBeTruthy();
// the buttons and inputs will only render for admin users
expect(wrapper.find('button').exists()).toBe(true);
expect(wrapper.find('input').length > 0).toBe(true);
});

it('renders Case Distribution App as read-only for a non admin', () => {
const store = getStore();

let wrapper = mount(
<Provider store={store}>
<CaseDistributionApp
acdLeversForStore={testLevers}
acd_levers={testLevers}
acd_history={leverHistory}
user_is_an_acd_admin={false}
/>
</Provider>
);

wrapper.update();

expect(wrapper.find('#lever-history-table').exists()).toBeTruthy();
expect(wrapper.find('.inactive-data-content').exists()).toBeTruthy();
expect(wrapper.find('.lever-content').exists()).toBeTruthy();
// the buttons and inputs will only render for admin users
expect(wrapper.find('button').exists()).toBe(false);
expect(wrapper.find('input').length === 0).toBe(true);
});

it('matches snapshot', () => {
const store = getStore();

const { container } = render(
<Provider store={store}>
<CaseDistributionApp
acdLeversForStore={testLevers}
acd_levers={testLevers}
acd_history={leverHistory}
user_is_an_acd_admin
/>
</Provider>
);

expect(container).toMatchSnapshot();
});
});

Loading
Loading