Skip to content

Commit

Permalink
resolve todo, this test already exists.
Browse files Browse the repository at this point in the history
Signed-off-by: Diana Barsan <barsan@medic.org>
  • Loading branch information
dianabarsan committed Aug 29, 2024
1 parent b9c23ff commit 0f36323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 5 additions & 9 deletions webapp/tests/karma/ts/effects/contacts.effects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ describe('Contacts effects', () => {
contactSummaryService = { get: sinon.stub().resolves({ cards: [], fields: [] }) };
targetAggregateService = { getTargetDocs: sinon.stub().resolves() };
tasksForContactService = { get: sinon.stub().resolves([]) };
contactTypesService = {
isPersonType: sinon.stub().resolves(true),
getTypeId: sinon.stub().returns('person'),
};
// todo add test where contact is not a person
contactTypesService = { getTypeId: sinon.stub().returns('person') };

TestBed.configureTestingModule({
imports: [
Expand Down Expand Up @@ -525,8 +521,8 @@ describe('Contacts effects', () => {
});
});

describe('loading targetDoc', () => {
it('should load targetDoc after loading reports', async () => {
describe('loading targetDocs', () => {
it('should load targetDocs after loading reports', async () => {
contactViewModelGeneratorService.getContact.resolves({ _id: 'person', doc: { _id: 'person' } });
contactViewModelGeneratorService.loadChildren.resolves([]);
contactViewModelGeneratorService.loadReports.resolves([{ _id: 'report' }]);
Expand All @@ -547,7 +543,7 @@ describe('Contacts effects', () => {
expect(receiveSelectedContactTargetDoc.args[0]).to.deep.equal([[{ _id: 'targetDoc' }]]);
});

it('should not receive target doc if the selected contact changes', async () => {
it('should not receive target docs if the selected contact changes', async () => {
contactViewModelGeneratorService.getContact.onFirstCall().resolves({_id: 'place', doc: {_id: 'place'}});
contactViewModelGeneratorService.getContact.onSecondCall().resolves({_id: 'person', doc: {_id: 'person'}});
contactViewModelGeneratorService.loadChildren.resolves([]);
Expand Down Expand Up @@ -595,7 +591,7 @@ describe('Contacts effects', () => {
expect(setSelectedContact.args[1][0]._id).to.equal('person');
});

it('should handle errors when loading the target doc', async () => {
it('should handle errors when loading the target docs', async () => {
sinon.stub(console, 'error');
const setSnackbarContent = sinon.stub(GlobalActions.prototype, 'setSnackbarContent');
const unsetSelected = sinon.stub(GlobalActions.prototype, 'unsetSelected');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1543,9 +1543,7 @@ describe('TargetAggregatesService', () => {
}]);
});



it('should not load target docs for contacts that are not people', async () => {
it('should not load target docs for contacts that are not persons', async () => {
const config = { tasks: { targets: { items: [
{ id: 'target1', aggregate: true, type: 'count' },
] } } };
Expand Down

0 comments on commit 0f36323

Please sign in to comment.