Skip to content

Commit 830563f

Browse files
committed
refactor: changed URL for compare and merge from api to v3 [CS-36688]
1 parent b0272bf commit 830563f

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

lib/stack/branch/compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { get } from '../../entity'
66
*/
77
export function Compare (http, data = {}) {
88
this.stackHeaders = data.stackHeaders
9-
this.urlPath = `/compare`
9+
this.urlPath = `/stacks/branches/compare`
1010

1111
/**
1212
* @description List of content types and global fields that exist in only one branch or are different between the two branches.

lib/stack/branch/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function Branch (http, data = {}) {
134134
* client.stack({ api_key: 'api_key'}).branch().merge(mergeObj, params)
135135
*/
136136
this.merge = async (mergeObj, params) => {
137-
const url = '/merge';
137+
const url = '/stacks/branches/merge';
138138
const header = {
139139
headers: { ...cloneDeep(this.stackHeaders)},
140140
params: params

lib/stack/branch/mergeQueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { get } from '../../entity'
22

33
export function MergeQueue (http, data = {}) {
44
this.stackHeaders = data.stackHeaders
5-
this.urlPath = `/merge-queue`
5+
this.urlPath = `/stacks/branches/merge-queue`
66

77
if (data.uid) {
88
/**

test/api/branch-test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('Branch api Test', () => {
129129
.catch(done)
130130
})
131131

132-
it('Should list differences for a single content type between two branches', done => {
132+
it('Should list differences for a content types between two branches', done => {
133133
makeBranch(branch.uid)
134134
.compare(devBranch.uid)
135135
.contentTypes()
@@ -141,7 +141,7 @@ describe('Branch api Test', () => {
141141
.catch(done)
142142
})
143143

144-
it('Should list differences for a single global field between two branches', done => {
144+
it('Should list differences for a global fields between two branches', done => {
145145
makeBranch(branch.uid)
146146
.compare(devBranch.uid)
147147
.globalFields()
@@ -202,14 +202,15 @@ describe('Branch api Test', () => {
202202
.catch(done)
203203
})
204204

205-
it('Should list all recent merge jobs', done => {
205+
it('Should list details of merge job when job uid is passed', done => {
206206
const mergeJobUid = 'db7bf199-2a9d-4c2c-99d5-72453f70fb40'
207207
makeBranch()
208208
.mergeQueue(mergeJobUid)
209209
.fetch()
210210
.then((response) => {
211-
expect(response.branches.base_branch).to.be.equal(branch.uid)
212-
expect(response.branches.compare_branch).to.be.equal(devBranch.uid)
211+
expect(response.queue).to.not.equal(undefined)
212+
expect(response.queue[0].merge_details.base_branch).to.be.equal(branch.uid)
213+
expect(response.queue[0].merge_details.compare_branch).to.be.equal(devBranch.uid)
213214
done()
214215
})
215216
.catch(done)

test/utility/ContentstackClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as contentstack from '../../lib/contentstack.js'
22
import dotenv from 'dotenv'
33
dotenv.config()
44
function contentstackClient (authtoken = null) {
5-
var params = { host: process.env.HOST, version: process.env.VERSION || 'v3', defaultHostName: process.env.DEFAULTHOST }
5+
var params = { host: process.env.HOST, defaultHostName: process.env.DEFAULTHOST }
66
if (authtoken) {
77
params.authtoken = authtoken
88
}

0 commit comments

Comments
 (0)