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
3 changes: 1 addition & 2 deletions lib/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions test/sanity-check/api/terms-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
Loading