Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/taxonomy-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class TaxonomyQuery extends Query {
* const result = await taxonomyQuery.find();
*/
override async find<T>(): Promise<FindResponse<T>> {
this._urlPath = "/taxonomy-manager"; // TODO: change to /taxonomies
this._urlPath = "/taxonomies";
const response = await getData(this._client, this._urlPath, {
params: this._queryParams,
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/taxonomy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Taxonomy {
constructor(client: AxiosInstance, taxonomyUid: string) {
this._client = client;
this._taxonomyUid = taxonomyUid;
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}`; // TODO: change to /taxonomies/${this._taxonomyUid}
this._urlPath = `/taxonomies/${this._taxonomyUid}`;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/term-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class TermQuery {
constructor(client: AxiosInstance, taxonomyUid: string) {
this._client = client;
this._taxonomyUid = taxonomyUid;
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}/terms`;
this._urlPath = `/taxonomies/${this._taxonomyUid}/terms`;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/term.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Term {
this._client = client;
this._taxonomyUid = taxonomyUid;
this._termUid = termUid;
this._urlPath = `/taxonomy-manager/${this._taxonomyUid}/terms/${this._termUid}`; // TODO: change to /taxonomies
this._urlPath = `/taxonomies/${this._taxonomyUid}/terms/${this._termUid}`;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/unit/taxonomy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ describe('ta class', () => {
});

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

it('should return single taxonomy in the response data when successful', async () => {
mockClient.onGet('/taxonomy-manager/taxonomy_testing').reply(200, taxonomyFindResponseDataMock.taxonomies[0]); //TODO: change to /taxonomies/taxonomyUid
mockClient.onGet('/taxonomies/taxonomy_testing').reply(200, taxonomyFindResponseDataMock.taxonomies[0]);
const response = await taxonomy.fetch();
expect(response).toEqual(taxonomyFindResponseDataMock.taxonomies[0]);
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/term-query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('TermQuery class', () => {
});

it('should return response data when successful', async () => {
mockClient.onGet('/taxonomy-manager/taxonomy_testing/terms').reply(200, termQueryFindResponseDataMock);
mockClient.onGet('/taxonomies/taxonomy_testing/terms').reply(200, termQueryFindResponseDataMock);
const response = await termQuery.find();
expect(response).toEqual(termQueryFindResponseDataMock);
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/term.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ describe('Term class', () => {
});

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

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

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

const response = await term.locales();
expect(response).toEqual(termLocalesResponseDataMock.terms);
});

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

const response = await term.ancestors();
expect(response).toEqual(termAncestorsResponseDataMock);
});

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

const response = await term.descendants();
expect(response).toEqual(termDescendantsResponseDataMock);
Expand Down