-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathauditlog-test.js
More file actions
32 lines (27 loc) · 1.01 KB
/
auditlog-test.js
File metadata and controls
32 lines (27 loc) · 1.01 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
import { expect } from 'chai'
import { describe, it, setup } from 'mocha'
import { jsonReader } from '../utility/fileOperations/readwrite.js'
import { contentstackClient } from '../utility/ContentstackClient.js'
let client = {}
let uid = ''
describe('Audit Log api Test', () => {
setup(() => {
const user = jsonReader('loggedinuser.json')
client = contentstackClient(user.authtoken)
})
it('Should Fetch all the Audit Logs', async () => {
const response = await makeAuditLog().fetchAll()
uid = response.items[0].uid
// eslint-disable-next-line no-unused-expressions
expect(Array.isArray(response.items)).to.be.true
// eslint-disable-next-line no-unused-expressions
expect(response.items[0].uid).not.to.be.undefined
})
it('Should Fetch a single audit log', async () => {
const response = await makeAuditLog(uid).fetch()
expect(response.log.uid).to.be.equal(uid)
})
})
function makeAuditLog (uid = null) {
return client.stack({ api_key: process.env.API_KEY }).auditLog(uid)
}