Skip to content

Commit

Permalink
Merge pull request #149 from contentstack/fix/dx-561-sanity-test
Browse files Browse the repository at this point in the history
reorder test suites
  • Loading branch information
harshithad0703 authored May 15, 2024
2 parents 28bd854 + 3af0d13 commit 488f22e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
27 changes: 0 additions & 27 deletions test/sanity-check/api/stack-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { expect } from 'chai'
import { describe, it, setup } from 'mocha'
import { jsonReader, jsonWrite } from '../utility/fileOperations/readwrite'
import { contentstackClient } from '../utility/ContentstackClient.js'
import { stageBranch } from '../mock/branch.js'

import dotenv from 'dotenv'
dotenv.config()
Expand Down Expand Up @@ -168,29 +167,3 @@ describe('Stack api Test', () => {
.catch(done)
})
})

describe('Branch creation api Test', () => {
setup(() => {
const user = jsonReader('loggedinuser.json')
client = contentstackClient(user.authtoken)
})

it('should create staging branch', done => {
makeBranch()
.create({ branch: stageBranch })
.then((response) => {
expect(response.uid).to.be.equal(stageBranch.uid)
expect(response.urlPath).to.be.equal(`/stacks/branches/${stageBranch.uid}`)
expect(response.source).to.be.equal(stageBranch.source)
expect(response.alias).to.not.equal(undefined)
expect(response.delete).to.not.equal(undefined)
expect(response.fetch).to.not.equal(undefined)
done()
})
.catch(done)
})
})

function makeBranch (uid = null) {
return client.stack({ api_key: process.env.API_KEY }).branch(uid)
}
27 changes: 27 additions & 0 deletions test/sanity-check/api/terms-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, it, beforeEach } from 'mocha'
import { expect } from 'chai'
import { jsonReader } from '../utility/fileOperations/readwrite'
import { contentstackClient } from '../utility/ContentstackClient.js'
import { stageBranch } from '../mock/branch.js'

var client = {}

Expand Down Expand Up @@ -172,3 +173,29 @@ describe('Terms API Test', () => {
function makeTerms (taxonomyUid, termUid = null) {
return client.stack({ api_key: process.env.API_KEY }).taxonomy(taxonomyUid).terms(termUid)
}

describe('Branch creation api Test', () => {
beforeEach(() => {
const user = jsonReader('loggedinuser.json')
client = contentstackClient(user.authtoken)
})

it('should create staging branch', done => {
makeBranch()
.create({ branch: stageBranch })
.then((response) => {
expect(response.uid).to.be.equal(stageBranch.uid)
expect(response.urlPath).to.be.equal(`/stacks/branches/${stageBranch.uid}`)
expect(response.source).to.be.equal(stageBranch.source)
expect(response.alias).to.not.equal(undefined)
expect(response.delete).to.not.equal(undefined)
expect(response.fetch).to.not.equal(undefined)
done()
})
.catch(done)
})
})

function makeBranch (uid = null) {
return client.stack({ api_key: process.env.API_KEY }).branch(uid)
}

0 comments on commit 488f22e

Please sign in to comment.