-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathapp-request-test.js
More file actions
52 lines (47 loc) · 1.37 KB
/
app-request-test.js
File metadata and controls
52 lines (47 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import dotenv from 'dotenv'
import { describe, it, setup } from 'mocha'
import { jsonReader } from '../utility/fileOperations/readwrite'
import { contentstackClient } from '../utility/ContentstackClient.js'
import { expect } from 'chai'
dotenv.config()
let apps = {}
const orgID = process.env.ORGANIZATION
let client = {}
let stack = {}
let requestUID = ''
describe('Apps request api Test', () => {
setup(() => {
const user = jsonReader('loggedinuser.json')
client = contentstackClient(user.authtoken)
apps = jsonReader('apps.json')
stack = jsonReader('stack.json')
})
it('test create app request', done => {
client.organization(orgID).request()
.create({ appUid: apps.uid, targetUid: stack.api_key })
.then((response) => {
requestUID = response.data.data.uid
expect(response.data).to.not.equal(undefined)
done()
})
.catch(done)
})
it('test get all request for oranization', done => {
client.organization(orgID).request()
.findAll()
.then((response) => {
expect(response.data).to.not.equal(undefined)
done()
})
.catch(done)
})
it('test delete app request', done => {
client.organization(orgID).request()
.delete(requestUID)
.then((response) => {
expect(response.data).to.not.equal(undefined)
done()
})
.catch(done)
})
})