|
1 |
| -import { expect } from "chai"; |
2 |
| -import { describe, it, setup } from "mocha"; |
3 |
| -import { jsonReader } from "../utility/fileOperations/readwrite.js"; |
| 1 | +import { expect } from 'chai' |
| 2 | +import { describe, it, setup } from 'mocha' |
| 3 | +import { jsonReader } from '../utility/fileOperations/readwrite.js' |
4 | 4 |
|
5 |
| -import { contentstackClient } from "../utility/ContentstackClient.js"; |
| 5 | +import { contentstackClient } from '../utility/ContentstackClient.js' |
6 | 6 |
|
7 |
| -let client = {}; |
8 |
| -let uid = ""; |
9 |
| -describe("Audit Log api Test", () => { |
| 7 | +let client = {} |
| 8 | +let uid = '' |
| 9 | +describe('Audit Log api Test', () => { |
10 | 10 | setup(() => {
|
11 |
| - const user = jsonReader("loggedinuser.json"); |
12 |
| - client = contentstackClient(user.authtoken); |
13 |
| - }); |
| 11 | + const user = jsonReader('loggedinuser.json') |
| 12 | + client = contentstackClient(user.authtoken) |
| 13 | + }) |
14 | 14 |
|
15 |
| - it("Should Fetch all the Audit Logs", async () => { |
16 |
| - const response = await makeAuditLog().fetchAll(); |
17 |
| - uid = response.items[0].uid; |
18 |
| - expect(Array.isArray(response.items)).to.be.true; |
19 |
| - expect(response.items[0].uid).not.to.be.undefined; |
20 |
| - }); |
| 15 | + it('Should Fetch all the Audit Logs', async () => { |
| 16 | + const response = await makeAuditLog().fetchAll() |
| 17 | + uid = response.items[0].uid |
| 18 | + // eslint-disable-next-line no-unused-expressions |
| 19 | + expect(Array.isArray(response.items)).to.be.true |
| 20 | + // eslint-disable-next-line no-unused-expressions |
| 21 | + expect(response.items[0].uid).not.to.be.undefined |
| 22 | + }) |
21 | 23 |
|
22 |
| - it("Should Fetch a single audit log", async () => { |
23 |
| - const response = await makeAuditLog(uid).fetch(); |
24 |
| - console.log(response); |
25 |
| - expect(response.log.uid).to.be.equal(uid); |
26 |
| - }); |
27 |
| -}); |
| 24 | + it('Should Fetch a single audit log', async () => { |
| 25 | + const response = await makeAuditLog(uid).fetch() |
| 26 | + console.log(response) |
| 27 | + expect(response.log.uid).to.be.equal(uid) |
| 28 | + }) |
| 29 | +}) |
28 | 30 |
|
29 |
| -function makeAuditLog(uid = null) { |
30 |
| - return client.stack({ api_key: process.env.API_KEY }).auditLog(uid); |
| 31 | +function makeAuditLog (uid = null) { |
| 32 | + return client.stack({ api_key: process.env.API_KEY }).auditLog(uid) |
31 | 33 | }
|
0 commit comments