From 2ae487c08c83ca295bcbd0540945430d0d130ad8 Mon Sep 17 00:00:00 2001 From: sunil-lakshman <104969541+sunil-lakshman@users.noreply.github.com> Date: Wed, 2 Jul 2025 17:27:45 +0530 Subject: [PATCH] Fixed term move issue --- lib/entity.js | 3 +-- test/sanity-check/api/terms-test.js | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/entity.js b/lib/entity.js index cf8ac93b..dc5742b7 100644 --- a/lib/entity.js +++ b/lib/entity.js @@ -313,7 +313,6 @@ export const move = (http, type, force = false, params = {}) => { try { let updateData = {} const json = cloneDeep(this) - delete json.parent_uid if (type) { updateData[type] = json } else { @@ -328,7 +327,7 @@ export const move = (http, type, force = false, params = {}) => { if (force === true) { headers.params.force = true } - const response = await http.put(`${this.urlPath}/move`, updateData, headers) + const response = await http.put(`${this.urlPath}/move`, param, headers) if (response.data) { return new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid, this.taxonomy_uid, http)) } else { diff --git a/test/sanity-check/api/terms-test.js b/test/sanity-check/api/terms-test.js index 871f870e..771ed9a0 100644 --- a/test/sanity-check/api/terms-test.js +++ b/test/sanity-check/api/terms-test.js @@ -135,13 +135,14 @@ describe('Terms API Test', () => { }) it('should move the term to parent uid passed', done => { - makeTerms(taxonomy.uid, childTerm2.term.uid).fetch() + const term = { + parent_uid: 'term_test_child1', + order: 1 + } + makeTerms(taxonomy.uid, childTerm2.term.uid).move({ term, force: true }) .then(async (term) => { - term.parent_uid = null - const moveTerm = await term.move({ force: true }) - expect(moveTerm.parent_uid).to.be.equal(null) + expect(term.parent_uid).to.not.equal(null) done() - return moveTerm }) .catch(done) })