Skip to content

Commit 142232f

Browse files
refacto?(api): add 'forAdmin' in method in target-profile-api
1 parent 7bfd71c commit 142232f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Diff for: api/src/prescription/target-profile/application/api/target-profile-api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export const getByOrganizationId = async (organizationId) => {
2121

2222
/**
2323
* @function
24-
* @name getById
24+
* @name getByIdForAdmin
2525
*
2626
* @param {number} id
2727
* @returns {Promise<TargetProfile>}
2828
*/
29-
export const getById = async (id) => {
29+
export const getByIdForAdmin = async (id) => {
3030
const targetProfileForAdmin = await usecases.getTargetProfileForAdmin({ targetProfileId: id });
3131

3232
return new TargetProfile(targetProfileForAdmin);

Diff for: api/tests/prescription/target-profile/acceptance/application/api/target-profile-api_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ describe('Acceptance | Application | target-profile-api', function () {
1414
});
1515
});
1616

17-
describe('#getById', function () {
17+
describe('#getByIdForAdmin', function () {
1818
it('should not fail', async function () {
1919
const targetProfileId = databaseBuilder.factory.buildTargetProfile().id;
2020

2121
await databaseBuilder.commit();
2222

23-
const result = await targetProfileApi.getById(targetProfileId);
23+
const result = await targetProfileApi.getByIdForAdmin(targetProfileId);
2424
expect(result).to.be.ok;
2525
});
2626
});

Diff for: api/tests/prescription/target-profile/unit/application/api/target-profile-api_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { catchErr, expect, sinon } from '../../../../../test-helper.js';
77
import { domainBuilder } from '../../../../../tooling/domain-builder/domain-builder.js';
88

99
describe('Unit | API | TargetProfile', function () {
10-
describe('#getById', function () {
10+
describe('#getByIdForAdmin', function () {
1111
it('should return target profile', async function () {
1212
const targetProfileId = 1;
1313
const targetProfileForAdmin = domainBuilder.buildTargetProfileForAdmin({ id: targetProfileId });
@@ -16,7 +16,7 @@ describe('Unit | API | TargetProfile', function () {
1616
const getTargetProfileForAdminStub = sinon.stub(usecases, 'getTargetProfileForAdmin');
1717
getTargetProfileForAdminStub.withArgs({ targetProfileId }).resolves(targetProfileForAdmin);
1818

19-
const targetProfile = await targetProfileApi.getById(targetProfileId);
19+
const targetProfile = await targetProfileApi.getByIdForAdmin(targetProfileId);
2020

2121
expect(targetProfile).to.deep.equal(expectedTargetProfile);
2222
});
@@ -27,7 +27,7 @@ describe('Unit | API | TargetProfile', function () {
2727
const getTargetProfileForAdminStub = sinon.stub(usecases, 'getTargetProfileForAdmin');
2828
getTargetProfileForAdminStub.withArgs({ targetProfileId }).rejects();
2929

30-
const error = await catchErr(targetProfileApi.getById)(targetProfileId);
30+
const error = await catchErr(targetProfileApi.getByIdForAdmin)(targetProfileId);
3131

3232
expect(error).to.be.ok;
3333
});

0 commit comments

Comments
 (0)