Skip to content

Commit

Permalink
fix: createEnterpriseGroup response camelCase (#1433)
Browse files Browse the repository at this point in the history
test: fix createEnterpriseGroup returns uuid for the post request
  • Loading branch information
marlonkeating authored Feb 20, 2025
1 parent d5fef09 commit 97f1445
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/data/services/LmsApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,20 @@ class LmsApiService {

static enterpriseLearnerUrl = `${LmsApiService.baseUrl}/enterprise/api/v1/enterprise-learner/`;

static createEnterpriseGroup({ groupName, enterpriseUUID }: CreateEnterpriseGroupArgs): EnterpriseGroup {
static async createEnterpriseGroup(
{
groupName,
enterpriseUUID,
}: CreateEnterpriseGroupArgs,
): EnterpriseGroupResponse {
const postParams = {
name: groupName,
enterprise_customer: enterpriseUUID,
members: [],
};
const createEnterpriseGroupUrl = `${LmsApiService.enterpriseGroupListUrl}`;
return camelCaseObject(LmsApiService.apiClient().post(createEnterpriseGroupUrl, postParams));
const response = await LmsApiService.apiClient().post(createEnterpriseGroupUrl, postParams);
return camelCaseObject(response);
}

static fetchEnterpriseSsoOrchestrationRecord(configurationUuid) {
Expand Down
14 changes: 11 additions & 3 deletions src/data/services/tests/LmsApiService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ describe('LmsApiService', () => {
},
});
const response = await LmsApiService.createEnterpriseGroup({
name: 'test-name',
enterprise_customer: 'test-customer-uuid',
members: [],
groupName: 'test-name',
enterpriseUUID: 'test-customer-uuid',
});

expect(response).toEqual({
status: 201,
data: {
Expand All @@ -113,6 +113,14 @@ describe('LmsApiService', () => {
members: [],
},
});
expect(axios.post).toHaveBeenCalledWith(
`${lmsBaseUrl}/enterprise/api/v1/enterprise_group/`,
{
name: 'test-name',
enterprise_customer: 'test-customer-uuid',
members: [],
},
);
});
test('fetchReportingConfigs returns reporting configs', async () => {
axios.get.mockResolvedValue({
Expand Down

0 comments on commit 97f1445

Please sign in to comment.