Skip to content

Commit 496fbbb

Browse files
Merge pull request #205 from contentstack/fix/add-delay-in-sanity
add delay for branch and term creation
2 parents 0d48a88 + 044f4d5 commit 496fbbb

File tree

3 files changed

+32
-49
lines changed

3 files changed

+32
-49
lines changed

test/sanity-check/api/branch-test.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ describe('Branch api Test', () => {
1212
client = contentstackClient(user.authtoken)
1313
})
1414

15-
it('should create a dev branch from stage branch', done => {
16-
makeBranch()
17-
.create({ branch: devBranch })
18-
.then((response) => {
19-
expect(response.uid).to.be.equal(devBranch.uid)
20-
expect(response.source).to.be.equal(devBranch.source)
21-
expect(response.alias).to.not.equal(undefined)
22-
expect(response.delete).to.not.equal(undefined)
23-
expect(response.fetch).to.not.equal(undefined)
24-
done()
25-
})
26-
.catch(done)
27-
})
15+
it('should create a dev branch from stage branch',async () => {
16+
const response = await makeBranch().create({ branch: devBranch });
17+
expect(response.uid).to.be.equal(devBranch.uid);
18+
expect(response.source).to.be.equal(devBranch.source);
19+
expect(response.alias).to.not.equal(undefined);
20+
expect(response.delete).to.not.equal(undefined);
21+
expect(response.fetch).to.not.equal(undefined);
22+
await new Promise(resolve => setTimeout(resolve, 15000));
23+
});
2824

2925
it('should return main branch when query is called', done => {
3026
makeBranch()

test/sanity-check/api/taxonomy-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('taxonomy api Test', () => {
3232
.catch(done)
3333
})
3434

35-
it('should fetch taxonomy of the uid passe', done => {
35+
it('should fetch taxonomy of the uid passed', done => {
3636
makeTaxonomy(taxonomyUID)
3737
.fetch()
3838
.then((taxonomyResponse) => {

test/sanity-check/api/terms-test.js

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,22 @@ describe('Terms API Test', () => {
4444
await client.stack({ api_key: process.env.API_KEY }).taxonomy().create({ taxonomy })
4545
}, 10000)
4646

47-
it('should create term', done => {
48-
makeTerms(taxonomy.uid).create(term)
49-
.then((response) => {
50-
expect(response.uid).to.be.equal(term.term.uid)
51-
done()
52-
})
53-
.catch(done)
47+
it('should create term', async () => {
48+
const response = await makeTerms(taxonomy.uid).create(term)
49+
expect(response.uid).to.be.equal(term.term.uid)
50+
await new Promise(resolve => setTimeout(resolve, 15000));
5451
})
5552

56-
it('should create child term 1', done => {
57-
makeTerms(taxonomy.uid).create(childTerm1)
58-
.then((response) => {
59-
expect(response.uid).to.be.equal(childTerm1.term.uid)
60-
done()
61-
})
62-
.catch(done)
53+
it('should create child term 1', async () => {
54+
const response = await makeTerms(taxonomy.uid).create(childTerm1)
55+
expect(response.uid).to.be.equal(childTerm1.term.uid)
56+
await new Promise(resolve => setTimeout(resolve, 15000));
6357
})
6458

65-
it('should create child term 2', done => {
66-
makeTerms(taxonomy.uid).create(childTerm2)
67-
.then((response) => {
68-
expect(response.uid).to.be.equal(childTerm2.term.uid)
69-
done()
70-
})
71-
.catch(done)
59+
it('should create child term 2', async () => {
60+
const response = await makeTerms(taxonomy.uid).create(childTerm2)
61+
expect(response.uid).to.be.equal(childTerm2.term.uid)
62+
await new Promise(resolve => setTimeout(resolve, 15000));
7263
})
7364

7465
it('should query and get all terms', done => {
@@ -180,20 +171,16 @@ describe('Branch creation api Test', () => {
180171
client = contentstackClient(user.authtoken)
181172
})
182173

183-
it('should create staging branch', done => {
184-
makeBranch()
185-
.create({ branch: stageBranch })
186-
.then((response) => {
187-
expect(response.uid).to.be.equal(stageBranch.uid)
188-
expect(response.urlPath).to.be.equal(`/stacks/branches/${stageBranch.uid}`)
189-
expect(response.source).to.be.equal(stageBranch.source)
190-
expect(response.alias).to.not.equal(undefined)
191-
expect(response.delete).to.not.equal(undefined)
192-
expect(response.fetch).to.not.equal(undefined)
193-
done()
194-
})
195-
.catch(done)
196-
})
174+
it('should create staging branch', async () => {
175+
const response = await makeBranch().create({ branch: stageBranch });
176+
expect(response.uid).to.be.equal(stageBranch.uid);
177+
expect(response.urlPath).to.be.equal(`/stacks/branches/${stageBranch.uid}`);
178+
expect(response.source).to.be.equal(stageBranch.source);
179+
expect(response.alias).to.not.equal(undefined);
180+
expect(response.fetch).to.not.equal(undefined);
181+
expect(response.delete).to.not.equal(undefined);
182+
await new Promise(resolve => setTimeout(resolve, 15000));
183+
});
197184
})
198185

199186
function makeBranch (uid = null) {

0 commit comments

Comments
 (0)