From 3af0d13a216e5af75b1b2be5ac4b6c843fe5199b Mon Sep 17 00:00:00 2001 From: harshithad0703 Date: Tue, 14 May 2024 18:28:18 +0530 Subject: [PATCH] reorder test suites --- test/sanity-check/api/stack-test.js | 27 --------------------------- test/sanity-check/api/terms-test.js | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/test/sanity-check/api/stack-test.js b/test/sanity-check/api/stack-test.js index 3377a110..76082f43 100644 --- a/test/sanity-check/api/stack-test.js +++ b/test/sanity-check/api/stack-test.js @@ -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() @@ -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) -} diff --git a/test/sanity-check/api/terms-test.js b/test/sanity-check/api/terms-test.js index ee2b83d2..3280023b 100644 --- a/test/sanity-check/api/terms-test.js +++ b/test/sanity-check/api/terms-test.js @@ -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 = {} @@ -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) +}