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

OCLOMRS-472: Implement the Retire/Un-Retire button #367

Merged
merged 1 commit into from Mar 28, 2019

Conversation

brucemakallan
Copy link
Contributor

JIRA TICKET NAME:

Implement the Retire/Un-Retire button

Summary:

Ensure that one can Retire custom Concepts as well as Unretire them

@brucemakallan
Copy link
Contributor Author

This PR is currently a Work In Progress

@brucemakallan brucemakallan force-pushed the OCLOMRS-472 branch 2 times, most recently from d90326d to 1406abd Compare March 19, 2019 09:58
@coveralls
Copy link

coveralls commented Mar 19, 2019

Pull Request Test Coverage Report for Build 2571

  • 26 of 26 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 96.985%

Totals Coverage Status
Change from base Build 2545: 0.06%
Covered Lines: 1897
Relevant Lines: 1932

💛 - Coveralls

@brucemakallan brucemakallan force-pushed the OCLOMRS-472 branch 9 times, most recently from a41b222 to a07295b Compare March 21, 2019 08:55
Copy link
Contributor

@AGMETEOR AGMETEOR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

package.json Outdated
@@ -30,7 +30,7 @@
"uuid": "^3.3.2"
},
"scripts": {
"start": "chmod +x ./init.sh && ./init.sh && cp env-config.js ./public/ && npm run build:css && react-scripts start",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related to the ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created a separate ticket for it. I'll remove the change from this one

@brucemakallan brucemakallan force-pushed the OCLOMRS-472 branch 3 times, most recently from b6cc573 to 308021e Compare March 27, 2019 12:10
});
});
const store = mockStore({ payload: {} });
return store.dispatch(retireConcept(sampleConcept.url, { retired: false })).then(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this testing for should unretire a concept?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the retireConcept() action to return the retired concept and I am now testing directly for the retired flag. expect(result.retired).toEqual(true); when retiring, and expect(result.retired).toEqual(false); when un-retiring.

@brucemakallan brucemakallan force-pushed the OCLOMRS-472 branch 2 times, most recently from 11f195e to a2702cb Compare March 28, 2019 03:46
@@ -381,6 +382,49 @@ describe('Test suite for dictionary actions', () => {
expect(store.getActions()).toEqual(expectedActions);
});
});

it('should retire a concept', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When should retire a concept happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action is triggered when the retire button is clicked

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you keep around to keep answering the maintainers of this code whenever they ask this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the message accordingly

});
});

it('should unretire a concept', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When should unretire a concept happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action is triggered when the unretire button is clicked

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the message accordingly.

response: sampleRetiredConcept,
});
});
const store = mockStore({ payload: {} });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are is the simulation of clicking the retire button?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DictionaryConcepts.test.jsx lines 528 - 621

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean in this very test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Action that is triggered when the button is clicked. The test is only for the Action and the button click test is in the lines I mentioned. Therefore the simulation for the button click is not (and should not be) in this test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then i find this confusing "should retire a concept when the retire button is clicked"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the concern. Should I change it to "should retire a concept when the retireConcept method is triggered"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the title to should retire a concept when the retireConcept action is triggered with the true argument

response: sampleConcept,
});
});
const store = mockStore({ payload: {} });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DictionaryConcepts.test.jsx lines 528 - 621

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the title to should unretire a concept when the retireConcept action is triggered with the false argument

@@ -18,6 +18,7 @@ import {
import { filterPayload } from '../../reducers/util';
import { addDictionaryReference } from '../bulkConcepts';
import api from '../../api';
import instance from '../../../config/axiosConfig';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the meaning of instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used a more appropriate name (axiosInstance)

@dkayiwa dkayiwa merged commit 8281ee5 into openmrs:master Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants