Skip to content

Commit

Permalink
feat(api): use method from prescription context
Browse files Browse the repository at this point in the history
  • Loading branch information
xav-car committed Dec 4, 2024
1 parent f9bcc75 commit 1cf1e60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import _ from 'lodash';

import * as organizationLearnerRepository from '../../../../lib/infrastructure/repositories/organization-learner-repository.js';
import * as organizationLearnerRepository from '../../../../src/prescription/learner-management/infrastructure/repositories/organization-learner-repository.js';
import * as membershipRepository from '../../../team/infrastructure/repositories/membership.repository.js';

const execute = async function (
userId,
organizationLearnerId,
dependencies = { membershipRepository, organizationLearnerRepository },
) {
const organizationLearner = await dependencies.organizationLearnerRepository.get(organizationLearnerId);
const organizationLearner = await dependencies.organizationLearnerRepository.getLearnerInfo(organizationLearnerId);
const memberships = await dependencies.membershipRepository.findByUserIdAndOrganizationId({
userId,
organizationId: organizationLearner.organizationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Unit | Application | Use Case | checkUserBelongsToLearnersOrganization
findByUserIdAndOrganizationId: sinon.stub(),
};
organizationLearnerRepositoryStub = {
get: sinon.stub(),
getLearnerInfo: sinon.stub(),
};
});

Expand All @@ -26,7 +26,7 @@ describe('Unit | Application | Use Case | checkUserBelongsToLearnersOrganization
id: organizationLearnerId,
organization: sharedOrganization,
});
organizationLearnerRepositoryStub.get.resolves(organizationLearner);
organizationLearnerRepositoryStub.getLearnerInfo.resolves(organizationLearner);
membershipRepositoryStub.findByUserIdAndOrganizationId.resolves([membership]);

// when
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('Unit | Application | Use Case | checkUserBelongsToLearnersOrganization
id: organizationLearnerId,
anotherOrganization,
});
organizationLearnerRepositoryStub.get.resolves(organizationLearner);
organizationLearnerRepositoryStub.getLearnerInfo.resolves(organizationLearner);
membershipRepositoryStub.findByUserIdAndOrganizationId.resolves([]);

// when
Expand Down

0 comments on commit 1cf1e60

Please sign in to comment.