Skip to content

Commit

Permalink
♻️ refactor: rename to specify OrganizationLearners
Browse files Browse the repository at this point in the history
Co-Authored-By: Aurélie Crouillebois <[email protected]>
  • Loading branch information
yaf and aurelie-crouillebois committed Oct 24, 2024
1 parent 7f626c1 commit f99c82f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function _addOralizationInformationToParticipants({
organizationParticipants,
organizationLearnerFeatureRepository,
}) {
const learnersWithOralizationFeature = await organizationLearnerFeatureRepository.getLearnersByFeature({
const learnersWithOralizationFeature = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({
organizationId,
featureKey: ORGANIZATION_FEATURE.ORALIZATION.key,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DomainTransaction } from '../../../../../lib/infrastructure/DomainTransaction.js';
import { OrganizationLearner } from '../../domain/read-models/OrganizationLearner.js';

async function getLearnersByFeature({ organizationId, featureKey }) {
async function getOrganizationLearnersByFeature({ organizationId, featureKey }) {
const knexConn = DomainTransaction.getConnection();
const rawOrganizationLearnerFeatures = await knexConn
.select('organization-learners.*')
Expand All @@ -19,4 +19,4 @@ async function getLearnersByFeature({ organizationId, featureKey }) {
);
}

export { getLearnersByFeature };
export { getOrganizationLearnersByFeature };
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import * as organizationLearnerFeatureRepository from '../../../../../src/prescr
import { databaseBuilder, expect } from '../../../../test-helper.js';

describe('Prescription | OrganizationLearner | Integration | Infrastructure | OrganizationLearnerFeatureRepository', function () {
describe('#getLearnersByFeature', function () {
describe('#getOrganizationLearnersByFeature', function () {
it('returns empty array when feature is unknown', async function () {
const organizationId = databaseBuilder.factory.buildOrganization().id;
const featureKey = 'AN_UNKNOWN_FEATURE';

await databaseBuilder.commit();

const result = await organizationLearnerFeatureRepository.getLearnersByFeature({ organizationId, featureKey });
const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey });

expect(result).to.deep.equal([]);
});
Expand All @@ -23,7 +23,7 @@ describe('Prescription | OrganizationLearner | Integration | Infrastructure | Or

await databaseBuilder.commit();

const result = await organizationLearnerFeatureRepository.getLearnersByFeature({ organizationId, featureKey });
const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey });

expect(result).to.deep.equal([]);
});
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Prescription | OrganizationLearner | Integration | Infrastructure | Or

const learner = new OrganizationLearner({ ...organizationLearner });

const result = await organizationLearnerFeatureRepository.getLearnersByFeature({ organizationId, featureKey });
const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey });

expect(result).to.deep.equal([learner]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Unit | UseCases | find-paginated-participants', function () {
};

organizationLearnerFeatureRepository = {
getLearnersByFeature: sinon.stub(),
getOrganizationLearnersByFeature: sinon.stub(),
};
});

Expand Down Expand Up @@ -157,7 +157,7 @@ describe('Unit | UseCases | find-paginated-participants', function () {
organizationParticipants: [participantWithOralization, participantWithoutOralization],
meta: {},
});
organizationLearnerFeatureRepository.getLearnersByFeature.resolves([learnerWithOralization]);
organizationLearnerFeatureRepository.getOrganizationLearnersByFeature.resolves([learnerWithOralization]);

// when
const result = await findPaginatedFilteredParticipants({
Expand Down

0 comments on commit f99c82f

Please sign in to comment.