Skip to content

Commit a85d2a2

Browse files
Merge pull request #284 from contentstack/feat/dx-3797-update-taxonomy-api
Feat/dx 3797 update taxonomy api
2 parents 251a61c + d88c4fc commit a85d2a2

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/lib/taxonomy-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class TaxonomyQuery extends Query {
2121
* const result = await taxonomyQuery.find();
2222
*/
2323
override async find<T>(): Promise<FindResponse<T>> {
24-
this._urlPath = "/taxonomy-manager"; // TODO: change to /taxonomies
24+
this._urlPath = "/taxonomies";
2525
const response = await getData(this._client, this._urlPath, {
2626
params: this._queryParams,
2727
});

src/lib/taxonomy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class Taxonomy {
2121
constructor(client: AxiosInstance, taxonomyUid: string) {
2222
this._client = client;
2323
this._taxonomyUid = taxonomyUid;
24-
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}`; // TODO: change to /taxonomies/${this._taxonomyUid}
24+
this._urlPath = `/taxonomies/${this._taxonomyUid}`;
2525
}
2626

2727
/**

src/lib/term-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class TermQuery {
1919
constructor(client: AxiosInstance, taxonomyUid: string) {
2020
this._client = client;
2121
this._taxonomyUid = taxonomyUid;
22-
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}/terms`;
22+
this._urlPath = `/taxonomies/${this._taxonomyUid}/terms`;
2323
}
2424

2525
/**

src/lib/term.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Term {
2020
this._client = client;
2121
this._taxonomyUid = taxonomyUid;
2222
this._termUid = termUid;
23-
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}/terms/${this._termUid}`; // TODO: change to /taxonomies
23+
this._urlPath = `/taxonomies/${this._taxonomyUid}/terms/${this._termUid}`;
2424
}
2525

2626
/**

test/unit/taxonomy.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ describe('ta class', () => {
3434
});
3535

3636
it('should return all taxonomies in the response data when successful', async () => {
37-
mockClient.onGet('/taxonomy-manager').reply(200, taxonomyFindResponseDataMock); //TODO: change to /taxonomies
37+
mockClient.onGet('/taxonomies').reply(200, taxonomyFindResponseDataMock);
3838
const response = await taxonomies.find();
3939
expect(response).toEqual(taxonomyFindResponseDataMock);
4040
});
4141

4242
it('should return single taxonomy in the response data when successful', async () => {
43-
mockClient.onGet('/taxonomy-manager/taxonomy_testing').reply(200, taxonomyFindResponseDataMock.taxonomies[0]); //TODO: change to /taxonomies/taxonomyUid
43+
mockClient.onGet('/taxonomies/taxonomy_testing').reply(200, taxonomyFindResponseDataMock.taxonomies[0]);
4444
const response = await taxonomy.fetch();
4545
expect(response).toEqual(taxonomyFindResponseDataMock.taxonomies[0]);
4646
});

test/unit/term-query.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('TermQuery class', () => {
1919
});
2020

2121
it('should return response data when successful', async () => {
22-
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms').reply(200, termQueryFindResponseDataMock);
22+
mockClient.onGet('/taxonomies/taxonomy_testing/terms').reply(200, termQueryFindResponseDataMock);
2323
const response = await termQuery.find();
2424
expect(response).toEqual(termQueryFindResponseDataMock);
2525
});

test/unit/term.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,28 @@ describe('Term class', () => {
2020
});
2121

2222
it('should fetch the term by uid response when fetch method is called', async () => {
23-
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms/term1').reply(200, termQueryFindResponseDataMock.terms[0]); //TODO: change to /taxonomies
23+
mockClient.onGet('/taxonomies/taxonomy_testing/terms/term1').reply(200, termQueryFindResponseDataMock.terms[0]);
2424

2525
const response = await term.fetch();
2626
expect(response).toEqual(termQueryFindResponseDataMock.terms[0]);
2727
});
2828

2929
it('should fetch locales for a term when locales() is called', async () => {
30-
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms/term1/locales').reply(200, termLocalesResponseDataMock.terms); //TODO: change to /taxonomies
30+
mockClient.onGet('/taxonomies/taxonomy_testing/terms/term1/locales').reply(200, termLocalesResponseDataMock.terms);
3131

3232
const response = await term.locales();
3333
expect(response).toEqual(termLocalesResponseDataMock.terms);
3434
});
3535

3636
it('should fetch ancestors for a term when ancestors() is called', async () => {
37-
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms/term1/ancestors').reply(200, termAncestorsResponseDataMock);
37+
mockClient.onGet('/taxonomies/taxonomy_testing/terms/term1/ancestors').reply(200, termAncestorsResponseDataMock);
3838

3939
const response = await term.ancestors();
4040
expect(response).toEqual(termAncestorsResponseDataMock);
4141
});
4242

4343
it('should fetch descendants for a term when descendants() is called', async () => {
44-
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms/term1/descendants').reply(200, termDescendantsResponseDataMock);
44+
mockClient.onGet('/taxonomies/taxonomy_testing/terms/term1/descendants').reply(200, termDescendantsResponseDataMock);
4545

4646
const response = await term.descendants();
4747
expect(response).toEqual(termDescendantsResponseDataMock);

0 commit comments

Comments
 (0)